public interface LanguageSupport
| Modifier and Type | Method and Description |
|---|---|
void |
emitLine(int line)
emit #line in C
|
void |
emitLine(int line,
String filename)
emit #line in C
|
void |
generateCaseEnd()
emit a case end statement
|
int |
generateCaseStart(int lineNumber,
String label,
String comment)
emit a case start
|
void |
generateCodeGeneratorFooter()
Generate the ending portion of the code generation
|
void |
generateCodeGeneratorHeader()
Output the top of the rules if needed
|
void |
generateEdgeHeader(int tableSize)
Generate the code for the edge table beginning
|
void |
generateErrorToken(int recoveryToken,
ErrorToken id,
boolean isLast)
Generates one entry for an error token
|
void |
generateIntArrayComment(String comment)
Output a comment in an array
|
void |
generateIntArrayFooter()
Output the end of an int array
|
void |
generateIntArrayRow(int i,
String comment,
int index,
int maxRows)
Output a row in an integer array
|
boolean |
generateLexerCode(FormattingPrintStream output,
String lexerMode,
Lexer lexer,
Terminal token,
int additionalIndent)
Emit the code for the lexical part of the grammar
|
void |
generateLexerFooter()
Generate the bottom of the lexer
|
void |
generateLexerHeader(List<String> modes)
Emit the header of the lexer as needed.
|
void |
generateLexerModeCase(String mode,
int i)
Generate the constant or 'define" for a given lexer mode
|
void |
generateLexerModeDefinition(String mode,
int i)
Generate the constant or 'define" for a given lexer mode
|
void |
generateLexerModeFooter(String mode)
Emit a lexer function footer by mode
|
void |
generateLexerModeHeader(String mode)
Emit a lexer function header by mode
|
void |
generateRecoveryTableHeader(int numberOfErrorTokens)
The recovery table deals with tokens that can be used to recognize
syntax context and can recover from errors.
|
void |
generateRegexEnd(FormattingPrintStream output)
Generate the bottom of a regex match in the scanner
|
void |
generateRegexMatch(FormattingPrintStream output,
int dfaNode)
Generate if statement for a regular expression match
|
void |
generateRegexReturn(FormattingPrintStream output,
Terminal token)
Generate the default return token for a regexp
|
boolean |
generateRuleCode(Lexer lexer,
EmbeddedCodeProcessor processor,
int elementCount,
String nonTerminalId,
int sourceColumn)
Parsing logic
Scan the input stream until a rule set of actions end.
|
boolean |
generateStructure(Lexer lexer)
For yacc compatibility this is called the union, but it is
really a structure
|
void |
generateToken(Terminal id,
boolean isLast)
Generate the code for a given token
|
void |
generateTokenDefinitions()
Declare all the tokens
|
void |
generateTokensHeader(int terminals)
Generates the top part of the token definition
|
void |
generateVertexHeader(int size)
Generate the vertex header
|
void |
generateVoidCodeGenerator()
there was no code generated.
|
boolean |
getDefaultIncludeFlag()
tells me the default value for include file generation
|
int |
getDefaultIndent()
the deault indentation is language dependent
|
String |
getExtensionSuffix()
get the source extension
|
String |
getId()
get the short, one-letter, or two-letter identifier for this language.
|
String |
getIncludeExtensionSuffix() |
String |
getLanguageCode()
get the string that identifies the language.
|
String |
getLexerModeRoutine(String lexerMode)
Given a lexer mode, return the routine definition
|
int |
getNumberOfSpacesPerIndent()
number of spaces per indent
|
String |
indent(FormattingPrintStream out,
int n)
Indents a number of separators, based on the number of spaces per indent.
|
String |
indent(int n)
Indents a number of separators, returning the string
|
void |
printAction(int action,
Action anAction)
Emit one action
|
void |
printActionHeader()
emit the header of the action table
|
void |
printCodeHeader()
print the declarations for the rest of the code
|
void |
printErrorEntry(int error)
Add errors to the table
|
void |
printErrorFooter()
Close the error table
|
void |
printErrorTableHeader()
declare the error table
|
void |
printGoTo(int gotoIndex,
GoTo pGoto)
Emit one go to
|
void |
printGoToTableHeader()
emit the goto table header
|
void |
printGrammarTable()
Output the whole grammar table
|
void |
printMissingSkeleton(String filename)
The skeleton was not found, say so.
|
void |
printPackedState(int stateNumber)
print a state in packed fashion
|
void |
printParserErrors()
Display the errors of the parser
|
void |
printParsingTableHeader()
Declare the parsing table
|
void |
printTableRow(int symbolCounter,
int[] parserLine,
int stateNumber)
print one row of the parsing table
|
String getLanguageCode()
String getId()
String getExtensionSuffix()
String getIncludeExtensionSuffix()
boolean getDefaultIncludeFlag()
int getDefaultIndent()
void emitLine(int line)
line - is the line numbervoid emitLine(int line,
String filename)
line - is the line numberfilename - is the filenameint getNumberOfSpacesPerIndent()
String indent(FormattingPrintStream out, int n)
out - is the output stream. it can be nulln - is the number of indentationsString indent(int n)
n - is the number of indentationsint generateCaseStart(int lineNumber,
String label,
String comment)
lineNumber - the line number on the sourcelabel - the label of the case statementcomment - is the comment of the casevoid generateCaseEnd()
boolean generateRuleCode(Lexer lexer, EmbeddedCodeProcessor processor, int elementCount, String nonTerminalId, int sourceColumn)
lexer - the element that will give me the lexical logicprocessor - is the processor for ruleselementCount - the number of elements in the rulenonTerminalId - the non terminal id for the rulesourceColumn - is the column numbervoid generateLexerHeader(List<String> modes)
modes - is the list of forward modesvoid generateLexerModeHeader(String mode)
mode - for the lexer modevoid generateLexerModeFooter(String mode)
mode - for the lexer modevoid generateLexerFooter()
void generateCodeGeneratorHeader()
void generateCodeGeneratorFooter()
void generateVoidCodeGenerator()
void generateRecoveryTableHeader(int numberOfErrorTokens)
numberOfErrorTokens - is the number of errorsboolean generateStructure(Lexer lexer)
lexer - is the lexical analyzervoid generateErrorToken(int recoveryToken,
ErrorToken id,
boolean isLast)
recoveryToken - the recovery idid - the ErrorTokenisLast - to check if this is the lastvoid generateTokensHeader(int terminals)
terminals - is the number of terminal symbolsvoid generateToken(Terminal id, boolean isLast)
id - is the token itselfisLast - to determine the way to emit the last tokenvoid generateTokenDefinitions()
boolean generateLexerCode(FormattingPrintStream output, String lexerMode, Lexer lexer, Terminal token, int additionalIndent)
output - is the stream to write tolexerMode - is the string representing the desired modelexer - is the lexer to obtain more characterstoken - is the current token for which generation is attemptedadditionalIndent - is the wanted indentation deltavoid printCodeHeader()
void printTableRow(int symbolCounter,
int[] parserLine,
int stateNumber)
symbolCounter - is the number of symbolsparserLine - is the array of linesstateNumber - is the state numbervoid printParsingTableHeader()
void printPackedState(int stateNumber)
stateNumber - is the id of the statevoid printErrorTableHeader()
void printErrorEntry(int error)
error - is the error numbervoid printErrorFooter()
void printActionHeader()
void printAction(int action,
Action anAction)
action - the action idanAction - the actual actionvoid printGoToTableHeader()
void printGoTo(int gotoIndex,
GoTo pGoto)
gotoIndex - the number of gotospGoto - the actual gotovoid printMissingSkeleton(String filename)
filename - the missing skeletonvoid printGrammarTable()
void printParserErrors()
void generateLexerModeDefinition(String mode, int i)
mode - is the mode of the lexeri - is the index of the definitionvoid generateLexerModeCase(String mode, int i)
mode - is the mode of the lexeri - is the index of the definitionvoid generateEdgeHeader(int tableSize)
tableSize - is the size of the tablevoid generateVertexHeader(int size)
size - is the number of nodesvoid generateIntArrayRow(int i,
String comment,
int index,
int maxRows)
i - is the integer to outputcomment, - a comment to add, if anyindex - is the row of this itemmaxRows - is the size of the array. Used to determine commas, etc.void generateIntArrayComment(String comment)
comment - is the comment to outputvoid generateIntArrayFooter()
void generateRegexMatch(FormattingPrintStream output, int dfaNode)
output - is the code streamdfaNode - is the starting dfa node to begin the matchvoid generateRegexReturn(FormattingPrintStream output, Terminal token)
output - is the code streamtoken - is the token that it returnsvoid generateRegexEnd(FormattingPrintStream output)
output - is the code streamCopyright © 2017. All rights reserved.