CSharpParserBase.java 1022 B

1234567891011121314151617181920212223242526
  1. package de.jplag.csharp.grammar;
  2. import org.antlr.v4.runtime.Parser;
  3. import org.antlr.v4.runtime.TokenStream;
  4. /**
  5. * This class was taken from <a href="https://github.com/antlr/grammars-v4/tree/master/csharp">antlr/grammars-v4</a>. It
  6. * was originally written by Ken Domino. Note that this class is licensed under Eclipse Public License - v 1.0.
  7. */
  8. public abstract class CSharpParserBase extends Parser {
  9. protected CSharpParserBase(TokenStream input) {
  10. super(input);
  11. }
  12. protected boolean IsLocalVariableDeclaration() {
  13. CSharpParser.Local_variable_declarationContext local_var_decl = (CSharpParser.Local_variable_declarationContext) this._ctx;
  14. if (local_var_decl == null)
  15. return true;
  16. CSharpParser.Local_variable_typeContext local_variable_type = local_var_decl.local_variable_type();
  17. if (local_variable_type == null)
  18. return true;
  19. if (local_variable_type.getText().equals("var"))
  20. return false;
  21. return true;
  22. }
  23. }