Skip to content

Commit

Permalink
add package && add test
Browse files Browse the repository at this point in the history
  • Loading branch information
alingse committed Nov 21, 2024
1 parent 97ba721 commit 2cee197
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package thriftlabs.thriftparser;

// Generated from Thrift.g4 by ANTLR 4.13.2

import org.antlr.v4.runtime.ParserRuleContext;
Expand Down
2 changes: 2 additions & 0 deletions java/src/main/java/thriftlabs/thriftparser/ThriftLexer.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package thriftlabs.thriftparser;

// Generated from Thrift.g4 by ANTLR 4.13.2
import org.antlr.v4.runtime.Lexer;
import org.antlr.v4.runtime.CharStream;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package thriftlabs.thriftparser;

// Generated from Thrift.g4 by ANTLR 4.13.2
import org.antlr.v4.runtime.tree.ParseTreeListener;

Expand Down
2 changes: 2 additions & 0 deletions java/src/main/java/thriftlabs/thriftparser/ThriftParser.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
package thriftlabs.thriftparser;

// Generated from Thrift.g4 by ANTLR 4.13.2
import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
Expand Down
9 changes: 7 additions & 2 deletions java/src/test/java/thriftlabs/thriftparser/ParserTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ public void testParse() {
CommonTokenStream tokens = new CommonTokenStream(lexer);
ThriftParser parser = new ThriftParser(tokens);

HeaderContext header = parser.header(0);
assertEquals("", header.String(), header.String());
ThriftParser.HeaderContext header = parser.header();
var n = header.include_();
TerminalNode tn = n.LITERAL();
Token t = tn.getSymbol();
String s = t.getText();

assertEquals("\"./other.thrift\"", s);
}
}

0 comments on commit 2cee197

Please sign in to comment.