Parses a single statement
@param  {Lexer} lex
@param  {bool}
@return {*}
323695
function parseStatement(lex, isRoot = false) {
    return parseFunctionDeclaration(lex) ||
           isRoot && parseOperatorStatement(lex) ||
           isRoot && parseObjectDeclaration(lex) ||
           parseIf(lex) ||
           parseReturn(lex) ||
           isRoot && parseExport(lex) ||
           isRoot && parseImport(lex) ||
           parseSwitchType(lex) ||
           parseWhile(lex) ||
           parseDoWhile(lex) ||
           parseFor(lex) ||
           parseBreak(lex) ||
           parseContinue(lex) ||
           parseExpressionBase(lex);
}
654245
function parseFunctionSourceElements() {
        var statement, body = [], token, directive, firstRestricted,
            oldLabelSet, oldInIteration, oldInSwitch, oldInFunctionBody, oldParenthesisCount,
            node = new Node();

        expect('{');

        while (startIndex < length) {
            if (lookahead.type !== Token.StringLiteral) {
                break;
            }
            token = lookahead;

            statement = parseStatementListItem();
            body.push(statement);
            if (statement.expression.type !== Syntax.Literal) {
                // this is not directive
                break;
            }
            directive = source.slice(token.start + 1, token.end - 1);
            if (directive === 'use strict') {
                strict = true;
                if (firstRestricted) {
                    tolerateUnexpectedToken(firstRestricted, Messages.StrictOctalLiteral);
                }
            } else {
                if (!firstRestricted && token.octal) {
                    firstRestricted = token;
                }
            }
        }

        oldLabelSet = state.labelSet;
        oldInIteration = state.inIteration;
        oldInSwitch = state.inSwitch;
        oldInFunctionBody = state.inFunctionBody;
        oldParenthesisCount = state.parenthesizedCount;

        state.labelSet = {};
        state.inIteration = false;
        state.inSwitch = false;
        state.inFunctionBody = true;
        state.parenthesizedCount = 0;

        while (startIndex < length) {
            if (match('}')) {
                break;
            }
            body.push(parseStatementListItem());
        }

        expect('}');

        state.labelSet = oldLabelSet;
        state.inIteration = oldInIteration;
        state.inSwitch = oldInSwitch;
        state.inFunctionBody = oldInFunctionBody;
        state.parenthesizedCount = oldParenthesisCount;

        return node.finishBlockStatement(body);
    }
946688
def p_lexpr(p):
    
    global LET_ASSIGNMENT

    LET_ASSIGNMENT = True  # Mark we're about to start a LET sentence

    if p[1] == 'LET':
        p[0] = p[2]
        i = 2
    else:
        p[0] = p[1]
        i = 1

    SYMBOL_TABLE.access_id(p[i], p.lineno(i))
1296721
function parse(inputText, entryPoint = "compilationUnit") {
  // Lex
  const lexResult = JavaLexer.tokenize(inputText);

  if (lexResult.errors.length > 0) {
    const firstError = lexResult.errors[0];
    throw Error(
      "Sad sad panda, lexing errors detected in line: " +
        firstError.line +
        ", column: " +
        firstError.column +
        "!\n" +
        firstError.message
    );
  }

  parser.input = attachComments(lexResult.tokens, lexResult.groups.comments);

  // Automatic CST created when parsing
  const cst = parser[entryPoint]();
  if (parser.errors.length > 0) {
    const error = parser.errors[0];
    throw Error(
      "Sad sad panda, parsing errors detected in line: " +
        error.token.startLine +
        ", column: " +
        error.token.startColumn +
        "!\n" +
        error.message +
        "!\n\t->" +
        error.context.ruleStack.join("\n\t->")
    );
  }

  return cst;
}
230188
function parsePrimary() {
                    var token, expr;

                    token = lexer.peek();

                    if (typeof token === 'undefined') {
                        throw new SyntaxError('Unexpected termination of expression');
                    }

                    if (token.type === T.Identifier) {
                        token = lexer.next();
                        if (matchOp(lexer.peek(), '(')) {
                            return parseFunctionCall(token.value);
                        } else {
                            return MathLib.Expression.variable(token.value);
                        }
                    }

                    if (token.type === T.Number) {
                        token = lexer.next();
                        return MathLib.Expression.number(token.value);
                    }

                    if (matchOp(token, '(')) {
                        lexer.next();
                        expr = parseAssignment();
                        token = lexer.next();
                        if (!matchOp(token, ')')) {
                            throw new SyntaxError('Expecting )');
                        }
                        return new MathLib.Expression({
                            subtype: 'brackets',
                            value: 'brackets',
                            content: expr
                        });
                    }

                    throw new SyntaxError('Parse error, can not process token ' + token.value);
                }
272691
def visitLexerAtom(self, ctx: jsgParser.LexerAtomContext):
        
        if ctx.LEXER_CHAR_SET() or ctx.ANY():
            self._rulePattern += str(ctx.getText())
        else:
            self.visitChildren(ctx)
522169
def parse_schema_definition(lexer: Lexer) -> Node:
    """"""
    start = lexer.token
    expect_keyword(lexer, "schema")
    directives = parse_directives(lexer, True)
    operation_types = many_nodes(
        lexer, TokenKind.BRACE_L, parse_operation_type_definition, TokenKind.BRACE_R
    )
    return Node(
        directives=directives, operation_types=operation_types, loc=loc(lexer, start)
    )
517537
function parsePrimaryExpression() {
        var token = lookahead(),
            type = token.type;

        if (type === Token.Identifier) {
            return {
                type: Syntax.Identifier,
                name: lex().value
            };
        }

        if (type === Token.StringLiteral || type === Token.NumericLiteral) {
            if (strict && token.octal) {
                throwErrorTolerant(token, Messages.StrictOctalLiteral);
            }
            return createLiteral(lex());
        }

        if (type === Token.Keyword) {
            if (matchKeyword('this')) {
                lex();
                return {
                    type: Syntax.ThisExpression
                };
            }

            if (matchKeyword('function')) {
                return parseFunctionExpression();
            }
        }

        if (type === Token.BooleanLiteral) {
            lex();
            token.value = (token.value === 'true');
            return createLiteral(token);
        }

        if (type === Token.NullLiteral) {
            lex();
            token.value = null;
            return createLiteral(token);
        }

        if (match('[')) {
            return parseArrayInitialiser();
        }

        if (match('{')) {
            return parseObjectInitialiser();
        }

        if (match('(')) {
            return parseGroupExpression();
        }

        if (match('/') || match('/=')) {
            return createLiteral(scanRegExp());
        }

        return throwUnexpected(lex());
    }
1260906
public void parse(final SelectStatement selectStatement) {
        if (!lexerEngine.skipIfEqual(DefaultKeyword.FOR)) {
            return;
        }
        lexerEngine.accept(DefaultKeyword.UPDATE);
        if (lexerEngine.skipIfEqual(DefaultKeyword.OF)) {
            do {
                basicExpressionParser.parse(selectStatement);
            } while (lexerEngine.skipIfEqual(Symbol.COMMA));
        }
        if (lexerEngine.equalAny(OracleKeyword.NOWAIT, OracleKeyword.WAIT)) {
            lexerEngine.nextToken();
        } else if (lexerEngine.skipIfEqual(OracleKeyword.SKIP)) {
            lexerEngine.accept(OracleKeyword.LOCKED);
        }
    }
251975
function parse(doc,context){
	var vs;
	var cmds=[];
	var pats;
	var exprs;
	var subpats;
	var mode=context.mode;

	var vs=splitLine_(doc);
	for(var i=0;i<vs.length;i++){
		if(pats=vs[i].match(macroRegex)){
			if(mode=='tcmd'){
				console.log(pats[1]+','+pats[2]);
			}
			exprs=null;
			switch(pats[1]){
			case 'define':
				if(subpats=pats[2].match(defineRegex)){
					exprs=[subpats[1],subpats[2]];
				}else{
					console.log("error: invalid format in define statement "+pats[1]+" in line "+(i+1));
				}
				break;
			case 'include':
			case 'include_once':
			case 'include_code':
			case 'include_code_once':
				exprs=toExpr(pats[2],i+1);
				break;
			case 'if':
			case 'elseif':
			case 'elif':
				exprs=toExpr(pats[2],i+1);
				break;
			case 'else':
			case 'endif':
				break;
			case 'namespace':
				if(subpats=pats[2].match(nsRegex)){
					setNamespace_(subpats[1]);
				}else{
					console.log("error: invalid format in namespace statement "+pats[1]+" in line "+(i+1));
				}
				break;
			default:
				if(pats[1].charAt(0)!='@'){
					console.log("error: unknown statement "+pats[1]+" in line "+(i+1));
				}
				break;
			}
			cmds.push({type:pats[1], exprs:exprs});
		}else{
			cmds.push({type:'text', value:vs[i]});
		}
	}
	if(mode=='cmd'){
		for(var i=0;i<cmds.length;i++){
			console.log(JSON.stringify(cmds[i]));
		}
	}
	return cmds;
}
1169819
function parse (expr) {
		var finalRegexp,
			strSlashPref;

		if (typeof expr !== 'string') {
			// Handle RegExp `expr`
			if (expr instanceof RegExp) {
				finalRegexp = new RegExp(expr);
				finalRegexp.query = execQuery;

				return finalRegexp;
			}

			throw new TypeError(
				'Usage: qbus.parse(<`query` = String|RegExp>)\n' + 
				'Got:   qbus.parse(<`' + typeof expr + '` = ' + expr + '>)'
			);
		}
		
		strSlashPref = expr[expr.length - 1] === '/';

		// Trim slashes and remove doubles
		expr = normalizePath(expr);

		// Pass everything from and including possible beginning frontslash
		// until and not including the next frontslash, to `parseLevel`.
		expr = expr.replace(/\/?[^\/]+?(?=\/|$)/g, function (match, index) {
			// Return level if it doesn't contain any modifiers.
			// : must be preceeded by / or start of string to count
			// ? must be used with valid : to count (so we don't need to check for that)
			// * always counts
			if (match.indexOf('*') === -1 && (match.length <= 2 || !/(^|\/)+\:+?/.test(match))) {
				return match.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
			}

			var slashSuff = match[0] === '/' ? '/' : '',
				slashPref = !!expr[match.length + index] || strSlashPref,
				level = slashSuff ? match.substr(1) : match,
				firstChar = level[0],
				lastChar = level.substr(-1);
			
			// Handle captures
			if (firstChar === ':') {
				// Handle optional :capture?
				if (lastChar === '?') {
					// Wrap any preceding slash in the optional capture group
					return (slashSuff ? '(?:/([^/]+?))?' : '([^/]+?)?');
				}

				// Handle mandatory :capture
				return slashSuff + '([^/]+?)';
			}

			// All matches that end with a slash or does not end with * are easy.
			// We'll just choose to capture anything except a frontslash.
			// 
			// /some/stuff*/   =>   /some/stuff([^/]+)?/
			// /some/st*ff/    =>   /some/st([^/]+)?ff/
			if (slashPref || lastChar !== '*') {
				return slashSuff + level.replace(/\*/g, '([^/]+)?');
			}

			// Handle all matches that ends with * and are not followd by frontslash; 'stuff*', '*'.
			// We'll replace all asterisks except the last with catch-alls. The last one is omitted and replaced with
			// a pattern that matches everything up until, but not included, the last frontslash in the string or end-of-string.
			// 
			// /some/stuff* => some/stuff(.*?(?:(?=\/$)|(?=$)))?
			// /some/st*ff* => some/st(.*)?ff(.*?(?:(?=\/$)|(?=$)))?
			// /*           => (.*?(?:(?=\\/$)|(?=$)))?
			return slashSuff + level.replace(/\*(?!$)/g, '(.*)?').slice(0, -1) + '(.*?(?:(?=/$)|(?=$)))?';
		});

		// Create RegExp object from the parsed query
		finalRegexp = new RegExp('^/?' + expr  + '/?$', 'i');

		// Add `execQuery` to it's properties
		finalRegexp.query = execQuery;

		return finalRegexp;
	}
1078565
function parseUnary() {
                    var token, expr;

                    token = lexer.peek();
                    if (matchOp(token, '-') || matchOp(token, '+')) {
                        token = lexer.next();
                        expr = parseUnary();
                        return new MathLib.Expression({
                            subtype: 'unaryOperator',
                            value: token.value,
                            content: expr
                        });
                    }

                    return parsePrimary();
                }
947075
function parseSwitchCase() {
        var test, consequent = [], statement, node = new Node();

        if (matchKeyword('default')) {
            lex();
            test = null;
        } else {
            expectKeyword('case');
            test = parseExpression();
        }
        expect(':');

        while (startIndex < length) {
            if (match('}') || matchKeyword('default') || matchKeyword('case')) {
                break;
            }
            statement = parseStatementListItem();
            consequent.push(statement);
        }

        return node.finishSwitchCase(test, consequent);
    }
287014
function parseDoWhileStatement() {
        var body, test, oldInIteration;

        expectKeyword('do');

        oldInIteration = inIteration;
        inIteration = true;

        body = parseStatement();

        inIteration = oldInIteration;

        expectKeyword('while');

        expect('(');

        test = parseExpression();

        expect(')');

        if (match(';')) {
            lex();
        }

        return {
            type: Syntax.DoWhileStatement,
            body: body,
            test: test
        };
    }
966536
function parseExpression() {
        var expr = parseAssignmentExpression();

        if (match(',')) {
            expr = {
                type: Syntax.SequenceExpression,
                expressions: [ expr ]
            };

            while (index < length) {
                if (!match(',')) {
                    break;
                }
                lex();
                expr.expressions.push(parseAssignmentExpression());
            }

        }
        return expr;
    }
939037
function make_lex( $i = 0 ){
		$Lex = new LexBuilder( $i );
		foreach( $this->collect_symbols() as $symbols ){
			foreach( $symbols as $t => $s ){
				if( preg_match('/^\W/', $s, $r ) ){
					$Lex->define_literal( (string) $t );
				}
				else if( $Lex->defined($s) ){
				}
				else if( defined($s) ){
					$Lex->redefine( $s );
				}
				else {
					$Lex->define( $t );
				}
			}
		}
		return $Lex;
	}
926772
function parseNext() {
			if(lexer.finish()) {
				setTimeout(function() {
					parse(nodes);
				}, cacheTime);
			}
			else {
				join(lexer.parseOn());
				setTimeout(parseNext, cacheTime);
			}
		}