mirror of
https://github.com/antlr/grammars-v4.git
synced 2026-06-08 00:13:35 +08:00
* Working version of bcpl grammar. Note, this grammar is very slow, requires a non-standard test driver, and is CSharp specific. * Clean up grammar. Remove useless parser symbols. Use assop rule. * Remove Antlr anti-pattern. Remove Antlr anti-pattern. * Removed useless parentheses. Removed parentheses that are unnecessary. * Split of the grammar. * Add lexer base class. * Changes to hide ChannelsCommonTokenStream. * Clean up. * Ported bcpl grammar to Java target. * Fixed semantics check for newlines. The lookahead must be screened for either default or the channel given when asking for lookahead or lookback.
22 lines
677 B
Java
22 lines
677 B
Java
import org.antlr.v4.runtime.*;
|
|
|
|
public abstract class bcplParserBase extends Parser {
|
|
public bcplParserBase(TokenStream input){
|
|
super(new ChannelCommonTokenStream(input));
|
|
}
|
|
|
|
public boolean IsNl()
|
|
{
|
|
Token c = ((ChannelCommonTokenStream)this.getInputStream()).LT(-1, 2);
|
|
Token d = ((ChannelCommonTokenStream)this.getInputStream()).LT(1, 2);
|
|
return c.getType() == bcplParser.NL;
|
|
}
|
|
|
|
public boolean IsNotNl()
|
|
{
|
|
Token c = ((ChannelCommonTokenStream)this.getInputStream()).LT(-1, 2);
|
|
Token d = ((ChannelCommonTokenStream)this.getInputStream()).LT(1, 2);
|
|
return d.getType() != bcplParser.NL;
|
|
}
|
|
}
|