public class Pascal extends BaseLanguageSupport
environment, runtime| Constructor and Description |
|---|
Pascal() |
| Modifier and Type | Method and Description |
|---|---|
protected String |
escapeDoubleQuotes(String error) |
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 size)
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 maxSize)
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 lexerMode,
int index)
Generate the constant or 'define" for a given lexer mode
|
void |
generateLexerModeDefinition(String lexerMode,
int index)
Generate the constant or 'define" for a given lexer mode
|
void |
generateLexerModeFooter(String lexerMode)
Emit a lexer function footer by mode
|
void |
generateLexerModeHeader(String lexerMode)
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
|
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
|
protected boolean |
lexerDollar(FormattingPrintStream output,
String lexerMode,
Lexer lexer,
Terminal token) |
protected void |
lexerReturnValue(FormattingPrintStream output,
String lexerMode,
Lexer lexer) |
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
|
computeModeName, emitLine, emitLine, getDefaultIndent, getEnvironment, getErrorMessage, getLexerCodeOffsetIndent, getNumberOfSpacesPerIndent, getRuntime, getShortSymbolName, indent, indent, lexerComment, lexerString, manageDollar, setEnvironment, setRuntimepublic String getLanguageCode()
LanguageSupportpublic String getId()
LanguageSupportpublic String getExtensionSuffix()
LanguageSupportpublic String getIncludeExtensionSuffix()
public boolean getDefaultIncludeFlag()
LanguageSupportgetDefaultIncludeFlag in interface LanguageSupportgetDefaultIncludeFlag in class BaseLanguageSupportpublic int generateCaseStart(int lineNumber,
String label,
String comment)
LanguageSupportlineNumber - the line number on the sourcelabel - the label of the case statementcomment - is the comment of the casepublic void generateCaseEnd()
LanguageSupportpublic boolean generateRuleCode(Lexer lexer, EmbeddedCodeProcessor processor, int elementCount, String nonTerminalId, int sourceColumn)
LanguageSupportgenerateRuleCode in interface LanguageSupportgenerateRuleCode in class BaseLanguageSupportlexer - 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 numberpublic void generateLexerHeader(List<String> modes)
LanguageSupportmodes - is the list of forward modespublic void generateLexerModeHeader(String lexerMode)
LanguageSupportlexerMode - for the lexer modepublic String getLexerModeRoutine(String lexerMode)
LanguageSupportlexerMode - is the desired lexer modepublic void generateLexerModeFooter(String lexerMode)
LanguageSupportlexerMode - for the lexer modepublic void generateLexerFooter()
LanguageSupportpublic void generateLexerModeDefinition(String lexerMode, int index)
LanguageSupportlexerMode - is the mode of the lexerindex - is the index of the definitionpublic void generateLexerModeCase(String lexerMode, int index)
LanguageSupportlexerMode - is the mode of the lexerindex - is the index of the definitionpublic void generateCodeGeneratorHeader()
LanguageSupportpublic void generateCodeGeneratorFooter()
LanguageSupportpublic void generateVoidCodeGenerator()
LanguageSupportpublic void generateRecoveryTableHeader(int numberOfErrorTokens)
LanguageSupportnumberOfErrorTokens - is the number of errorspublic boolean generateStructure(Lexer lexer)
LanguageSupportlexer - is the lexical analyzerpublic void generateErrorToken(int recoveryToken,
ErrorToken id,
boolean isLast)
LanguageSupportrecoveryToken - the recovery idid - the ErrorTokenisLast - to check if this is the lastpublic void generateTokensHeader(int terminals)
LanguageSupportterminals - is the number of terminal symbolspublic void generateToken(Terminal id, boolean isLast)
LanguageSupportid - is the token itselfisLast - to determine the way to emit the last tokenpublic void generateTokenDefinitions()
LanguageSupportprotected String escapeDoubleQuotes(String error)
escapeDoubleQuotes in class BaseLanguageSupportprotected boolean lexerDollar(FormattingPrintStream output, String lexerMode, Lexer lexer, Terminal token)
lexerDollar in class BaseLanguageSupportprotected void lexerReturnValue(FormattingPrintStream output, String lexerMode, Lexer lexer)
public boolean generateLexerCode(FormattingPrintStream output, String lexerMode, Lexer lexer, Terminal token, int additionalIndent)
LanguageSupportgenerateLexerCode in interface LanguageSupportgenerateLexerCode in class BaseLanguageSupportoutput - 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 deltapublic void printCodeHeader()
LanguageSupportpublic void printTableRow(int symbolCounter,
int[] parserLine,
int stateNumber)
LanguageSupportsymbolCounter - is the number of symbolsparserLine - is the array of linesstateNumber - is the state numberpublic void printParserErrors()
LanguageSupportpublic void printParsingTableHeader()
LanguageSupportpublic void printPackedState(int stateNumber)
LanguageSupportstateNumber - is the id of the statepublic void printErrorTableHeader()
LanguageSupportpublic void printErrorEntry(int error)
LanguageSupporterror - is the error numberpublic void printErrorFooter()
LanguageSupportpublic void printActionHeader()
LanguageSupportpublic void printAction(int action,
Action anAction)
LanguageSupportaction - the action idanAction - the actual actionpublic void printGoToTableHeader()
LanguageSupportpublic void printGoTo(int gotoIndex,
GoTo pGoto)
LanguageSupportgotoIndex - the number of gotospGoto - the actual gotopublic void printMissingSkeleton(String filename)
LanguageSupportfilename - the missing skeletonpublic void printGrammarTable()
LanguageSupportpublic void generateEdgeHeader(int size)
LanguageSupportsize - is the size of the tablepublic void generateVertexHeader(int size)
LanguageSupportsize - is the number of nodespublic void generateIntArrayRow(int i,
String comment,
int index,
int maxSize)
LanguageSupporti - is the integer to outputindex - is the row of this itemmaxSize - is the size of the array. Used to determine commas, etc.public void generateIntArrayComment(String comment)
LanguageSupportcomment - is the comment to outputpublic void generateIntArrayFooter()
LanguageSupportpublic void generateRegexMatch(FormattingPrintStream output, int dfaNode)
LanguageSupportoutput - is the code streamdfaNode - is the starting dfa node to begin the matchpublic void generateRegexReturn(FormattingPrintStream output, Terminal token)
LanguageSupportoutput - is the code streamtoken - is the token that it returnspublic void generateRegexEnd(FormattingPrintStream output)
LanguageSupportoutput - is the code streamCopyright © 2017. All rights reserved.