Examples of ANTLRStringStream


Examples of org.antlr.runtime.ANTLRStringStream

        assertTrue( parser.hasErrors() );
    }

    public void testRuleSingleLine() throws Exception {
        final String text = "rule \"another test\" salience 10 when eval( true ) then System.out.println(1); end";
        final CharStream charStream = new ANTLRStringStream( text );
        final DRLLexer lexer = new DRLLexer( charStream );
        final TokenStream tokenStream = new CommonTokenStream( lexer );
        final DRLParser parser = new DRLParser( tokenStream );
        parser.setLineOffset( 10 );
        RuleDescr rule = parser.rule();
View Full Code Here

Examples of org.antlr.runtime.ANTLRStringStream

                      rule.getConsequence() );
    }

    public void testRuleTwoLines() throws Exception {
        final String text = "rule \"another test\" salience 10 when eval( true ) then System.out.println(1);\n end";
        final CharStream charStream = new ANTLRStringStream( text );
        final DRLLexer lexer = new DRLLexer( charStream );
        final TokenStream tokenStream = new CommonTokenStream( lexer );
        final DRLParser parser = new DRLParser( tokenStream );
        parser.setLineOffset( 10 );
        RuleDescr rule = parser.rule();
View Full Code Here

Examples of org.antlr.runtime.ANTLRStringStream

     *
     * @param dataProvider The data provider to use when converting keywords to values
     * @param format       The formatting string to use when doing the formatting
     */
    public TitleFormat(DataProvider dataProvider, String format) {
        parser = new TitleFormatParser(dataProvider, new CommonTokenStream(new TitleFormatLexer(new ANTLRStringStream(format))));
    }
View Full Code Here

Examples of org.antlr.runtime.ANTLRStringStream

     * Create a new title formatter class using the specified format and the default data provider
     *
     * @param format The formatting string to use when doing the formatting
     */
    public TitleFormat(String format) {
        parser = new TitleFormatParser(new AttributeDataProvider(), new CommonTokenStream(new TitleFormatLexer(new ANTLRStringStream(format))));
    }
View Full Code Here

Examples of org.antlr.runtime.ANTLRStringStream

   * @param convertIntoValidXML  Converts the output into valid XML for XSL processing for example
   */
  public static void process( Reader reader, Writer writer, IHTMLFilter htmlFilter, boolean convertIntoValidXML ) throws HandlingException {
    try {
      // Open a char stream input for the document
      ANTLRStringStream input = new ANTLRReaderStream( reader );
     
      // Start lexing the input
      htmlLexerLexer lex = new htmlLexerLexer(input);

      // Tokenstream for the parser.
View Full Code Here

Examples of org.antlr.runtime.ANTLRStringStream

   
    public static MetaData parse(String uid) throws RecognitionException {
        if (uid == null || uid.trim().length() == 0)
            return null;

        CharStream stream = new ANTLRStringStream(uid);
        UdlLexer lexer = new UdlLexer(stream);
        TokenStream tokenStream = new CommonTokenStream(lexer);
        UdlParser parser = new UdlParser(tokenStream);
        return parser.uid();
    }
View Full Code Here

Examples of org.antlr.runtime.ANTLRStringStream

    /** Parse an expression from text */
    public ConstraintConnectiveDescr parse( final String text ) {
        ConstraintConnectiveDescr constraint = null;
        try {
            DRLLexer lexer = new DRLLexer( new ANTLRStringStream( text ) );
            CommonTokenStream input = new CommonTokenStream( lexer );
            RecognizerSharedState state = new RecognizerSharedState();
            helper = new ParserHelper( input,
                                       state );
            DRLExpressions parser = new DRLExpressions( input, state, helper );
View Full Code Here

Examples of org.antlr.runtime.ANTLRStringStream

    /**
     * @return An instance of a RuleParser should you need one (most folks will
     *         not).
     */
    private DRLParser getParser( final String text ) {
        lexer = new DRLLexer( new ANTLRStringStream( text ) );
        DRLParser parser = new DRLParser( new CommonTokenStream( lexer ) );
        return parser;
    }
View Full Code Here

Examples of org.antlr.runtime.ANTLRStringStream

        return analyze( result,
                        availableIdentifiers );
    }

    private JavaParser parse(final String expr) {
        final CharStream charStream = new ANTLRStringStream(expr);
        final JavaLexer lexer = new JavaLexer( charStream );
        final TokenStream tokenStream = new CommonTokenStream( lexer );
        return new JavaParser( tokenStream );
    }
View Full Code Here

Examples of org.antlr.runtime.ANTLRStringStream

  }
 

  public InstrumentedCode instrument(Code code) {
    StringTemplateGroup templates = new StringTemplateGroup(new CharArrayReader(TEMPLATE));
    ANTLRStringStream stream = new ANTLRStringStream(code.getSourceCode());
    Integer fileId = mapper.map(code.getFilePath());
    String mappedName = String.valueOf(fileId);
    stream.name = mappedName;
    ES3InstrumentLexer lexer = new ES3InstrumentLexer(stream);
    TokenRewriteStream tokens = new TokenRewriteStream(lexer);
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.