LLK

Builtin methods and variables for grammar actions

LLK generate a number of builtin (public/protected) methods and variables that can be in by the grammar actions (grammar action should avoid using private methods and variables generated by LLK). Only a few important builtins are described here.

Builtin variables:

  • llkMain - The ILLKMain instance.
  • llkInput - The ILLKLexerInput, ILLKParserInput and ILLKTreeParserInput instance.
  • llkTree - The LLKTree instance.
  • llkThis - The current node.

Builtin methods:

  • LA0() - Return token type of the just consumed token.
  • LA1() - Return token type of the next lookahead token.
  • LA(int n) - Return token type of the nth lookahead token.
  • LT0() - Return just consumed token.
  • LT1() - Return next lookahead token.
  • LT(int n) - Return nth lookahead token.
  • llkConsume() - Consume the next token.
  • llkConsume(int n) - Consume the next n token.
  • llkGetMain() - Return llkMain.
  • llkGetInput() - Return llkLexerInput, llkParserInput or llkTreeParserInput instance.
  • llkRewind(ILLKToken t) - Rewind input to end of the given token.
  • llkGetOffset() - Return the offset of the current token.
  • llkGetSource() - Return source in the specified range.
  • llkGetLocation() - Return the mapped location of the specified offset.
  • llkCreateToken() - Create a token of specified type.
Lexer specific:
  • llkEnableKeyword() - Enable specified keyword context.
  • llkDisableKeyword() - Disable specified keyword context.
  • llkSetContext() - Set current context to the specified context.
  • llkGetContext() - Get the current context.
  • llkSetDirectiveHandler() - Set directive handler, see IDirectHandler.java for details.
  • llkGetDirectiveHandler() - Get directive handler.
There are many more, for now, see the soruce code for details.