コード例 #1
0
 public static LinearIntegerExpression parseLinearExpression(String input)
 {
     var stream = new AntlrInputStream(input);
     var lexer = new SymbolicStringsLexer(stream);
     var tokens = new CommonTokenStream(lexer);
     var parser = new SymbolicStringsParser(tokens);
     parser.BuildParseTree = true;
     var tree = parser.integer();
     if (parser.NumberOfSyntaxErrors == 0)
         return tree.value;
     return null;
 }
コード例 #2
0
 public static SymbolicString parseSymbolicString(String input, List<String> alphabet)
 {
     var stream = new AntlrInputStream(input);
     var lexer = new SymbolicStringsLexer(stream);
     var tokens = new CommonTokenStream(lexer);
     var parser = new SymbolicStringsParser(tokens);
     parser.alphabet = alphabet;
     parser.BuildParseTree = true;
     var tree = parser.symbolic_string();
     if (parser.NumberOfSyntaxErrors == 0 && parser.word_error == null)
         return tree.value;
     return null;
 }
コード例 #3
0
        public static LinearIntegerExpression parseLinearExpression(String input)
        {
            var stream = new AntlrInputStream(input);
            var lexer  = new SymbolicStringsLexer(stream);
            var tokens = new CommonTokenStream(lexer);
            var parser = new SymbolicStringsParser(tokens);

            parser.BuildParseTree = true;
            var tree = parser.integer();

            if (parser.NumberOfSyntaxErrors == 0)
            {
                return(tree.value);
            }
            return(null);
        }
コード例 #4
0
        public static SymbolicString parseSymbolicString(String input, List <String> alphabet)
        {
            var stream = new AntlrInputStream(input);
            var lexer  = new SymbolicStringsLexer(stream);
            var tokens = new CommonTokenStream(lexer);
            var parser = new SymbolicStringsParser(tokens);

            parser.alphabet       = alphabet;
            parser.BuildParseTree = true;
            var tree = parser.symbolic_string();

            if (parser.NumberOfSyntaxErrors == 0 && parser.word_error == null)
            {
                return(tree.value);
            }
            return(null);
        }