Examples of ParseResult


Examples of com.dci.intellij.dbn.language.common.element.parser.ParseResult

        int elementCounter = 0;
        int matchedTokens = 0;
        //TokenType tokenType = (TokenType) builder.getTokenType();
        // check if the token objectType can be part of this iteration
        //if (isDummyToken(builder.getTokenText()) || isSuppressibleReservedWord(tokenType, node) || iteratedElementType.containsToken(tokenType)) {
            ParseResult result = iteratedElementType.getParser().parse(node, optional, depth + 1, context);


            // check first iteration element
            if (result.isMatch()) {
                if (node.isRecursive(node.getStartOffset())) {
                    return stepOut(marker, depth, ParseResultType.FULL_MATCH, matchedTokens, node, context);
                }
                while (true) {
                    elementCounter++;
                    // check separator
                    // if not matched just step out
                    if (separatorTokens != null) {
                        for (TokenElementType separatorToken : separatorTokens) {
                            result = separatorToken.getParser().parse(node, false, depth + 1, context);
                            matchedTokens = matchedTokens + result.getMatchedTokens();
                            if (result.isMatch()) break;
                        }

                        if (result.isNoMatch()) {
                            // if NO_MATCH, no additional separator found, hence then iteration should exit with MATCH
                            ParseResultType resultType = matchesElementsCount(elementCounter) ?
                                    ParseResultType.FULL_MATCH :
                                    ParseResultType.PARTIAL_MATCH;
                            return stepOut(marker, depth, resultType, matchedTokens, node, context);
                        } else {
                            node.setCurrentOffset(builder.getCurrentOffset());
                        }
                    }

                    // check consecutive iterated element
                    // if not matched, step out with error

                    result = iteratedElementType.getParser().parse(node, true, depth + 1, context);

                    if (result.isNoMatch()) {
                        // missing separators permit ending the iteration as valid at any time
                        if (separatorTokens == null) {
                            ParseResultType resultType = matchesElementsCount(elementCounter) ?
                                    ParseResultType.FULL_MATCH :
                                    ParseResultType.PARTIAL_MATCH;
                            return stepOut(marker, depth, resultType, matchedTokens, node, context);
                        } else {
                            boolean exit = advanceLexerToNextLandmark(parentNode, false, context);
                            if (exit){
                                return stepOut(marker, depth, ParseResultType.PARTIAL_MATCH, matchedTokens, node, context);
                            }
                        }
                    } else {
                        matchedTokens = matchedTokens + result.getMatchedTokens();
                    }
                }
            }
        //}
        if (!optional) {
View Full Code Here

Examples of com.espertech.esper.epl.parse.ParseResult

        ParseRuleSelector startRuleSelector = new ParseRuleSelector() {
            public Tree invokeParseRule(EsperEPL2GrammarParser parser) throws RecognitionException {
                return parser.startJsonValueRule();
            }
        };
        ParseResult parseResult = ParseHelper.parse(json, json, true, startRuleSelector, false);
        EsperEPL2GrammarParser.StartJsonValueRuleContext tree = (EsperEPL2GrammarParser.StartJsonValueRuleContext) parseResult.getTree();
        Object parsed = ASTJsonHelper.walk(parseResult.getTokenStream(), tree.jsonvalue());

        if (!(parsed instanceof Map)) {
            throw new ExprValidationException("Failed to map value to object of type " + topClass.getName() + ", expected Json Map/Object format, received " + (parsed != null ? parsed.getClass().getSimpleName() : "null"));
        }
        Map<String, Object> objectProperties = (Map<String, Object>) parsed;
View Full Code Here

Examples of com.github.sommeri.less4j.core.parser.ANTLRParser.ParseResult

  @Test
  public void stylesheet() throws RecognitionException {
    String crashingSelector =   "p:not([class**=\"lead\"]) {\n  color: black;\n}";
    ANTLRParser compiler = new ANTLRParser();
    ParseResult result = compiler.parseStyleSheet(crashingSelector, null);

    //the -3 is correct, even if it seems like huge hack. It sort of is.
    //RBRACE }; LBRACE {; RBRACKET ] and LBRACKET [ are (correctly thrown away)
    //and one dummy node EMPTY_COMBINATOR is added during the translation.
    //therefore there are -3 dummy nodes
    //this way of testing malformed trees is bad anyway,this needs to be changed
    //for something more readable and stable. (These tests are broken with each tree change)
    assertNoTokenMissing(crashingSelector, result.getTree(), -4);
  }
View Full Code Here

Examples of com.google.appengine.tools.util.Parser.ParseResult

    } catch (IOException e) {
      throw new RuntimeException("Unable to enable logging.", e);
    }

    try {
      ParseResult result =
          parser.parseArgs(actionsAndOptions.actions, actionsAndOptions.options, cmdLineArgs);
      action = (AppCfgAction) result.getAction();
      validateCommandLineForEar();
      try {
        result.applyArgs();
      } catch (IllegalArgumentException e) {
        e.printStackTrace(logWriter);
        System.out.println("Bad argument: " + e.getMessage());
        System.out.println(action.getHelpString());
        System.exit(1);
View Full Code Here

Examples of com.google.appengine.tools.util.Parser.ParseResult

  public DevAppServerMain() {
  }

  public void run(String[] args) throws Exception {
    Parser parser = new Parser();
    ParseResult result = parser.parseArgs(ACTION, buildOptions(), args);
    result.applyArgs();
  }
View Full Code Here

Examples of com.google.code.vimsztool.parser.ParseResult

 
  private static String[] primitiveTypeNames = { "boolean", "byte", "char",
    "short", "int", "long", "float", "double" };
 
  public static void main(String[] args) {
    ParseResult result = AstTreeFactory.getExpressionAst("new Date(2+3)");
    if (result.hasError()) {
      System.out.println(result.getErrorMsg());
    }
    System.out.println(result.getTree());
   
  }
View Full Code Here

Examples of com.google.common.jimfs.PathType.ParseResult

      if (path.startsWith("$")) {
        root = "$";
        path = path.substring(1);
      }

      return new ParseResult(root, splitter().split(path));
    }
View Full Code Here

Examples of com.google.javascript.jscomp.parsing.ParserRunner.ParseResult

    Config config = new Config(new HashSet<String>(),
        new HashSet<String>(), true, LanguageMode.ECMASCRIPT6, false);
    // TODO(lpino): ParserRunner reports errors if the expression is not
    // ES6 valid. We need to abort the validation of the type transformation
    // whenever an error is reported.
    ParseResult result = ParserRunner.parse(
        sourceFile, typeTransformationString, config, errorReporter);
    Node ast = result.ast;
    // Check that the expression is a script with an expression result
    if (!ast.isScript() || !ast.getFirstChild().isExprResult()) {
      warnInvalidExpression("type transformation", ast);
View Full Code Here

Examples of com.google.javascript.jscomp.parsing.ParserRunner.ParseResult

   * Verify that the given code has the given parse errors.
   * @return If in IDE mode, returns a partial tree.
   */
  private Node parseError(String source, String... errors) {
    TestErrorReporter testErrorReporter = new TestErrorReporter(errors, null);
    ParseResult result = ParserRunner.parse(
        new SimpleSourceFile("input", false),
        source,
        ParserRunner.createConfig(isIdeMode, mode, false, null),
        testErrorReporter);
    Node script = result.ast;
View Full Code Here

Examples of com.google.javascript.jscomp.parsing.ParserRunner.ParseResult

    TestErrorReporter testErrorReporter = new TestErrorReporter(null, warnings);
    Config config =
        new Config(extraAnnotations, extraSuppressions,
            true, LanguageMode.ECMASCRIPT3, false);

    ParseResult result = ParserRunner.parse(
        new SimpleSourceFile("source", false), code, config, testErrorReporter);

    assertTrue("some expected warnings were not reported",
        testErrorReporter.hasEncounteredAllWarnings());
    return result.ast;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.