Permalink
Browse files

parser: ensure we always get a lexer

Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
  • Loading branch information...
1 parent 8475c54 commit 6ecb17acf9ae81ce618fa4068cbee39141a4c90c @Keruspe Keruspe committed Apr 18, 2012
@@ -53,9 +53,8 @@
private String _namespace = "";
private HashMap<String, String> _namespaceUseMap = new HashMap<String, String>();
- public BiancaLexer(BiancaParser parser, ReadStream is) {
+ public BiancaLexer(BiancaParser parser) {
this._parser = parser;
- this._is = is;
}
public void init(ReadStream is) {
@@ -100,7 +100,6 @@ public BiancaParser(BiancaContext bianca,
this(bianca);
init(sourceFile, is);
- _lexer = new BiancaLexer(this, is);
}
private void init(Path sourceFile)
@@ -123,6 +122,8 @@ private void init(Path sourceFile, ReadStream is) {
_parserLocation.setLineNumber(1);
+ if (_lexer == null)
+ _lexer = new BiancaLexer(this);
_lexer.init(is);
}

0 comments on commit 6ecb17a

Please sign in to comment.