Search in sources :

Example 1 with Token

use of priv.bajdcc.OP.syntax.token.Token in project jMiniLang by bajdcc.

the class TestSyntaxLexer method main.

public static void main(String[] args) {
    try {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        SyntaxLexer lexer = new SyntaxLexer();
        lexer.setContext(str);
        Token token;
        for (; ; ) {
            token = lexer.nextToken();
            if (token.kToken == TokenType.EOF) {
                break;
            }
            System.out.println(token.toString());
        }
        scanner.close();
    } catch (RegexException e) {
        System.err.println(e.getPosition() + "," + e.getMessage());
        e.printStackTrace();
    }
}
Also used : Scanner(java.util.Scanner) SyntaxLexer(priv.bajdcc.OP.syntax.lexer.SyntaxLexer) RegexException(priv.bajdcc.util.lexer.error.RegexException) Token(priv.bajdcc.OP.syntax.token.Token)

Aggregations

Scanner (java.util.Scanner)1 SyntaxLexer (priv.bajdcc.OP.syntax.lexer.SyntaxLexer)1 Token (priv.bajdcc.OP.syntax.token.Token)1 RegexException (priv.bajdcc.util.lexer.error.RegexException)1