abc-music ::= *(abc-line / comment / xcommand / tune-field / tex)
164734
Rule AbcMusic() {
		return ZeroOrMore(
			SequenceS(
				ZeroOrMore(WSP()).suppressNode(),
				FirstOfS(
						Xcommand(), Comment(), 
						TuneField(), AbcLine(),
						Tex()
				)
			)
		).label(AbcMusic);
	}
164436
function(command) {
        var patt = /("[^"]*")/,
            quotedStringPlaceholder = "__QUOTEDSTR__",
            escapedQuotePlaceholder = "__ESCAPED_QUOTE__",
            matches = [],
            match;

        command = command.replace(/\\\"/g, escapedQuotePlaceholder);

        while ((match = patt.exec(command))) {
            var matched = match[0];
            command =
                command.substr(0, match.index) + quotedStringPlaceholder + command.substr(match.index + matched.length);
            matches.push(matched.substring(1, matched.length - 1));
        }

        var parts = command.split(" ");
        parts = parts.map(function(part) {
            var item = part.trim();
            if (item === quotedStringPlaceholder) {
                item = matches.shift();
            }
            item = item.replace(new RegExp(escapedQuotePlaceholder, "g"), '"');
            return item;
        });

        return parts;
    }
863996
function _fillInputRadio(name, value, next) {
        this.element({
            value: "//input[@name='"+escapeString(name, "'")+"' and @value='"+escapeString(value, "'")+"']",
            strategy: "xpath"
            }, function (el) {
                el.click(next);
            });
    }
601055
def _from_docstring_md(doc):
    

    def format_fn(line, status):
        """ format function """

        def fix_tags(line):
            # In markdown we need to escape < > and & for display
            # but we don't want to do this is the value is quoted
            # by backticks ``

            def fn(match):
                # swap matched chars
                found = match.group(1)
                if found == "<":
                    return "&lt;"
                if found == ">":
                    return "&gt;"
                if found == "&":
                    return "&amp;"
                return match.group(0)

            return re_from_tag.sub(fn, line)

        if re_from_data.match(line):
            line = re_from_data.sub(r"**\1** ", line)
            status["add_line"] = True
        line = re_from_defaults.sub(r"*\1*", line)
        if status["listing"]:
            # parameters
            if re_from_param.match(line):
                m = re_from_param.match(line)
                line = "  - `{}` {}".format(m.group(1), fix_tags(m.group(3)))
            # status items
            elif re_from_status.match(line):
                m = re_from_status.match(line)
                line = "  - `{}` {}".format(m.group(1), fix_tags(m.group(3)))
            # bullets
            elif re_from_item.match(line):
                line = re_from_item.sub(r"  -", fix_tags(line))
            # is continuation line
            else:
                line = fix_tags(line)
                line = " " * 4 + line.lstrip()
        else:
            line = fix_tags(line)
        return line

    return _reformat_docstring(doc, format_fn, code_newline="\n")
154117
Rule AbcHeader() {
		return FirstOf(
				SequenceS(
						OptionalS(FieldNumber()),
						OptionalS(TitleFields()),
						ZeroOrMoreS(OtherFields()),
						FieldKey()),
				SequenceS(
						OptionalS(FieldNumber()),
						TitleFields(),
						ZeroOrMoreS(OtherFields()),
						OptionalS(FieldKey())),
				SequenceS(
					FieldNumber(),
					OptionalS(TitleFields()),
					ZeroOrMoreS(OtherFields()),
					OptionalS(FieldKey()))
			)
			.label(AbcHeader);
	}
1244291
function toMusicXML() {
        $out  = '';
        $out .= '<accent';
        if (!empty($this->placement)) {
	        $out .= ' placement="'.$this->placement.'"';
	    }
        if (!empty($this->type)) {
	        $out .= ' type="'.$this->type.'"';
	    }
        if (!empty($this->defaultX)) {
	        $out .= ' default-x="'.$this->defaultX.'"';
	    }
        if (!empty($this->defaultY)) {
	        $out .= ' default-y="'.$this->defaultY.'"';
	    }

        $out .= '/>';
        return $out;
    }
479937
def insert(self, i, tag, affix, cmd="hassuf", tagged=None):
        
        if affix.startswith("-") and affix.endswith("-"):
            affix, cmd = affix[+1:-1], "char"
        if affix.startswith("-"):
            affix, cmd = affix[+1:-0], "hassuf"
        if affix.endswith("-"):
            affix, cmd = affix[+0:-1], "haspref"
        if tagged:
            r = [tagged, affix, "f"+cmd.lstrip("f"), tag, "x"]
        else:
            r = [affix, cmd.lstrip("f"), tag, "x"]
        lazylist.insert(self, i, r)
297660
public Rule AbcFile() {
		//return ZeroOrMore(FirstOfS(AbcTune(), Comment(), Xcommand(),
		//		FileField(), TextLine(), Tex())).label("AbcFile");
		return Sequence(
			ZeroOrMore(
				FirstOfS(Eols(),
					Comment(), Xcommand(), Tex(),
					FileField(), TextLine() 
				)).label(AbcTuneBookHeader),
			AbcTune(),
			ZeroOrMoreS(
				//SequenceS(
				//	ZeroOrMoreS(Comment()),
				//	OptionalS(Eols()),
					//FirstOf(EOI, AbcTune())
					AbcTune()
				//)
			)
		).label(AbcFile);
	}
1060261
public final void mString() throws RecognitionException {
        try {
            int _type = String;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // src/riemann/Query.g:105:9: ( '\"' ( EscapeSequence | ~ ( '\\u0000' .. '\\u001f' | '\\\\' | '\\\"' ) )* '\"' )
            // src/riemann/Query.g:108:5: '\"' ( EscapeSequence | ~ ( '\\u0000' .. '\\u001f' | '\\\\' | '\\\"' ) )* '\"'
            {
            match('\"'); 
            // src/riemann/Query.g:108:9: ( EscapeSequence | ~ ( '\\u0000' .. '\\u001f' | '\\\\' | '\\\"' ) )*
            loop11:
            do {
                int alt11=3;
                int LA11_0 = input.LA(1);

                if ( (LA11_0=='\\') ) {
                    alt11=1;
                }
                else if ( ((LA11_0>=' ' && LA11_0<='!')||(LA11_0>='#' && LA11_0<='[')||(LA11_0>=']' && LA11_0<='\uFFFF')) ) {
                    alt11=2;
                }


                switch (alt11) {
            	case 1 :
            	    // src/riemann/Query.g:108:11: EscapeSequence
            	    {
            	    mEscapeSequence(); 

            	    }
            	    break;
            	case 2 :
            	    // src/riemann/Query.g:108:28: ~ ( '\\u0000' .. '\\u001f' | '\\\\' | '\\\"' )
            	    {
            	    if ( (input.LA(1)>=' ' && input.LA(1)<='!')||(input.LA(1)>='#' && input.LA(1)<='[')||(input.LA(1)>=']' && input.LA(1)<='\uFFFF') ) {
            	        input.consume();

            	    }
            	    else {
            	        MismatchedSetException mse = new MismatchedSetException(null,input);
            	        recover(mse);
            	        throw mse;}


            	    }
            	    break;

            	default :
            	    break loop11;
                }
            } while (true);

            match('\"'); 

            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
1145115
function(composer, command, tagName, className, classRegExp, cssStyle, styleRegExp) {
      var that = this;

      if (this.state(composer, command, tagName, className, classRegExp, cssStyle, styleRegExp) &&
        composer.selection.isCollapsed() &&
        !composer.selection.caretIsLastInSelection() &&
        !composer.selection.caretIsFirstInSelection()
      ) {
        var state_element = that.state(composer, command, tagName, className, classRegExp)[0];
        composer.selection.executeAndRestoreRangy(function() {
          var parent = state_element.parentNode;
          composer.selection.selectNode(state_element, true);
          wysihtml5.commands.formatInline.exec(composer, command, tagName, className, classRegExp, cssStyle, styleRegExp, true, true);
        });
      } else {
        if (this.state(composer, command, tagName, className, classRegExp, cssStyle, styleRegExp) && !composer.selection.isCollapsed()) {
          composer.selection.executeAndRestoreRangy(function() {
            wysihtml5.commands.formatInline.exec(composer, command, tagName, className, classRegExp, cssStyle, styleRegExp, true, true);
          });
        } else {
          wysihtml5.commands.formatInline.exec(composer, command, tagName, className, classRegExp, cssStyle, styleRegExp);
        }
      }
    }
298727
function _execCommand(doc, composer, command, nodeName, className) {
    var ranges = composer.selection.getOwnRanges();
    for (var i = ranges.length; i--;){
      composer.selection.getSelection().removeAllRanges();
      composer.selection.setSelection(ranges[i]);
      if (className) {
        var eventListener = dom.observe(doc, "DOMNodeInserted", function(event) {
          var target = event.target,
              displayStyle;
          if (target.nodeType !== wysihtml5.ELEMENT_NODE) {
            return;
          }
          displayStyle = dom.getStyle("display").from(target);
          if (displayStyle.substr(0, 6) !== "inline") {
            // Make sure that only block elements receive the given class
            target.className += " " + className;
          }
        });
      }
      doc.execCommand(command, false, nodeName);

      if (eventListener) {
        eventListener.stop();
      }
    }
  }
8649
public void play(Module module, int source, boolean loop, boolean start) {
		this.source = source;
		this.loop = loop;
		this.module = module;
		done = false;
		
		ibxm = new IBXM(48000);
		ibxm.set_module(module);
		songDuration = ibxm.calculate_song_duration();

		if (bufferNames != null) {
			AL10.alSourceStop(source);
			bufferNames.flip();
			AL10.alDeleteBuffers(bufferNames);
		}
		
		bufferNames = BufferUtils.createIntBuffer(2);
		AL10.alGenBuffers(bufferNames);
		remainingBufferCount = 2;
		
		for (int i=0;i<2;i++) {
	        stream(bufferNames.get(i));
		}
        AL10.alSourceQueueBuffers(source, bufferNames);
		AL10.alSourcef(source, AL10.AL_PITCH, 1.0f);
		AL10.alSourcef(source, AL10.AL_GAIN, 1.0f); 
		
		if (start) {
			AL10.alSourcePlay(source);
		}
	}
500489
static function basic($string, $filterIn = array("Tidy","Dom","Striptags"), $filterOut = "none") {
        $string = self::tidyUp($string, $filterIn);
        $string = str_replace(array("&amp;", "&lt;", "&gt;"), array("&amp;amp;", "&amp;lt;", "&amp;gt;"), $string);
        
        // fix &entitiy\n;
        $string = preg_replace('#(&\#*\w+)[\x00-\x20]+;#u', "$1;", $string);
        $string = preg_replace('#(&\#x*)([0-9A-F]+);*#iu', "$1$2;", $string);

        $string = html_entity_decode($string, ENT_COMPAT, "UTF-8");
        
        // remove any attribute starting with "on" or xmlns
        $string = preg_replace('#(<[^>]+[\x00-\x20\"\'\/])(on|xmlns)[^>]*>#iUu', "$1>", $string);
        
        // remove javascript: and vbscript: protocol
        $string = preg_replace('#([a-z]*)[\x00-\x20\/]*=[\x00-\x20\/]*([\`\'\"]*)[\x00-\x20\/]*j[\x00-\x20]*a[\x00-\x20]*v[\x00-\x20]*a[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iUu', '$1=$2nojavascript...', $string);
        $string = preg_replace('#([a-z]*)[\x00-\x20\/]*=[\x00-\x20\/]*([\`\'\"]*)[\x00-\x20\/]*v[\x00-\x20]*b[\x00-\x20]*s[\x00-\x20]*c[\x00-\x20]*r[\x00-\x20]*i[\x00-\x20]*p[\x00-\x20]*t[\x00-\x20]*:#iUu', '$1=$2novbscript...', $string);
        $string = preg_replace('#([a-z]*)[\x00-\x20\/]*=[\x00-\x20\/]*([\`\'\"]*)[\x00-\x20\/]*-moz-binding[\x00-\x20]*:#Uu', '$1=$2nomozbinding...', $string);
        $string = preg_replace('#([a-z]*)[\x00-\x20\/]*=[\x00-\x20\/]*([\`\'\"]*)[\x00-\x20\/]*data[\x00-\x20]*:#Uu', '$1=$2nodata...', $string);
        
        //remove any style attributes, IE allows too much stupid things in them, eg.
        //<span style="width: expression(alert('Ping!'));"></span> 
        // and in general you really don't want style declarations in your UGC

        $string = preg_replace('#(<[^>]+[\x00-\x20\"\'\/])style[^>]*>#iUu', "$1>", $string);

        //remove namespaced elements (we do not need them...)
        $string = preg_replace('#</*\w+:\w[^>]*>#i', "", $string);
        
        //remove really unwanted tags
        do {
            $oldstring = $string;
            $string = preg_replace('#</*(applet|meta|xml|blink|link|style|script|embed|object|iframe|frame|frameset|ilayer|layer|bgsound|title|base)[^>]*>#i', "", $string);
        } while ($oldstring != $string);
        
        return self::tidyUp($string, $filterOut);
    }
497980
Rule XcomUnit() {
		return Optional(FirstOf(IgnoreCase("cm"), IgnoreCase("pt"), IgnoreCase("in")))
			.label(XcomUnit).suppressSubnodes();
	}
801574
function writeMatch(match, offset) {
    var lz77Array = match.toLz77Array();

    push(lz77buf, lz77Array);
    freqsLitLen[lz77Array[0]]++;
    freqsDist[lz77Array[3]]++;
    skipLength = match.length + offset - 1;
    prevMatch = null;
  }
1094121
function toMusicXML() {
		$out = '';
		 $out .= '<repeat';
		if (!empty($this->direction)) {
			$out .= ' direction="' . $this->direction . '"';
		}
		if (!empty($this->winged)) {
			$out .= ' winged="' . $this->winged . '"';
		}
		if (!empty($this->times)) {
			$out .= ' times="' . $this->times . '"';
		}

		$out .= '></repeat>';
		return $out;

	}
899908
public final void mMULTI_LINE_COMMENT() throws RecognitionException {
		try {
			int _type = MULTI_LINE_COMMENT;
			int _channel = DEFAULT_TOKEN_CHANNEL;
			// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:324:5: ( '/*' ( options {greedy=false; } : . )* '*/' )
			// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:324:7: '/*' ( options {greedy=false; } : . )* '*/'
			{
			match("/*"); if (state.failed) return;

			// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:324:12: ( options {greedy=false; } : . )*
			loop59:
			while (true) {
				int alt59=2;
				int LA59_0 = input.LA(1);
				if ( (LA59_0=='*') ) {
					int LA59_1 = input.LA(2);
					if ( (LA59_1=='/') ) {
						alt59=2;
					}
					else if ( ((LA59_1 >= '\u0000' && LA59_1 <= '.')||(LA59_1 >= '0' && LA59_1 <= '\uFFFF')) ) {
						alt59=1;
					}

				}
				else if ( ((LA59_0 >= '\u0000' && LA59_0 <= ')')||(LA59_0 >= '+' && LA59_0 <= '\uFFFF')) ) {
					alt59=1;
				}

				switch (alt59) {
				case 1 :
					// src/main/resources/org/drools/compiler/lang/DRL5Lexer.g:324:38: .
					{
					matchAny(); if (state.failed) return;
					}
					break;

				default :
					break loop59;
				}
			}

			match("*/"); if (state.failed) return;

			if ( state.backtracking==0 ) { _channel=HIDDEN; }
			}

			state.type = _type;
			state.channel = _channel;
		}
		finally {
			// do for sure before leaving
		}
	}