Paradox Game Engine  v1.0.0 beta06
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Events Macros Pages
Irony.Parsing.Grammar Class Reference
Inheritance diagram for Irony.Parsing.Grammar:
SiliconStudio.Shaders.Grammar.ShaderGrammar SiliconStudio.Shaders.Grammar.Hlsl.HlslGrammar SiliconStudio.Paradox.Shaders.Parser.Grammar.ParadoxGrammar

Public Member Functions

bool FlagIsSet (LanguageFlags flag)
 
virtual LanguageData CreateLanguageData ()
 
 Grammar ()
 
 Grammar (bool caseSensitive)
 
void MarkReservedWords (params string[] reservedWords)
 
void RegisterOperators (int precedence, params string[] opSymbols)
 
void RegisterOperators (int precedence, Associativity associativity, params string[] opSymbols)
 
void RegisterOperators (int precedence, params BnfTerm[] opTerms)
 
void RegisterOperators (int precedence, Associativity associativity, params BnfTerm[] opTerms)
 
void RegisterBracePair (string openBrace, string closeBrace)
 
void MarkPunctuation (params string[] symbols)
 
void MarkPunctuation (params BnfTerm[] terms)
 
void MarkTransient (params NonTerminal[] nonTerminals)
 
void MarkMemberSelect (params string[] symbols)
 
void MarkNotReported (params BnfTerm[] terms)
 
void MarkNotReported (params string[] symbols)
 
virtual void CreateTokenFilters (LanguageData language, TokenFilterList filters)
 
virtual Token TryMatch (ParsingContext context, ISourceStream source)
 
virtual string GetParseNodeCaption (ParseTreeNode node)
 
virtual void CreateAstNode (ParsingContext context, ParseTreeNode nodeInfo)
 
virtual void OnScannerSelectTerminal (ParsingContext context)
 Override this method to help scanner select a terminal to create token when there are more than one candidates for an input char. Context.CurrentTerminals contains candidate terminals; leave a single terminal in this list as the one to use. More...
 
virtual void OnResolvingConflict (ConflictResolutionArgs args)
 Override this method to provide custom conflict resolution; for example, custom code may decide proper shift or reduce action based on preview of tokens ahead. More...
 
virtual void OnGrammarDataConstructed (LanguageData language)
 
virtual void OnLanguageDataConstructed (LanguageData language)
 
virtual string ConstructParserErrorMessage (ParsingContext context, StringSet expectedTerms)
 
virtual void ReportParseError (ParsingContext context)
 
KeyTerm ToTerm (string text)
 
KeyTerm ToTerm (string text, string name)
 

Static Public Member Functions

static BnfExpression MakePlusRule (NonTerminal listNonTerminal, BnfTerm listMember)
 
static BnfExpression MakePlusRule (NonTerminal listNonTerminal, BnfTerm delimiter, BnfTerm listMember, TermListOptions options)
 
static BnfExpression MakePlusRule (NonTerminal listNonTerminal, BnfTerm delimiter, BnfTerm listMember)
 
static BnfExpression MakeStarRule (NonTerminal listNonTerminal, BnfTerm listMember)
 
static BnfExpression MakeStarRule (NonTerminal listNonTerminal, BnfTerm delimiter, BnfTerm listMember)
 
static BnfExpression MakeStarRule (NonTerminal listNonTerminal, BnfTerm delimiter, BnfTerm listMember, TermListOptions options)
 

Public Attributes

readonly bool CaseSensitive = true
 Gets case sensitivity of the grammar. Read-only, true by default. Can be set to false only through a parameter to grammar constructor. More...
 
readonly StringComparer LanguageStringComparer
 
string Delimiters = null
 
string WhitespaceChars = " \t\r\n\v"
 
string LineTerminators = "\n\r\v"
 
LanguageFlags LanguageFlags = LanguageFlags.Default
 
TermReportGroupList TermReportGroups = new TermReportGroupList()
 
readonly TerminalSet NonGrammarTerminals = new TerminalSet()
 
readonly TerminalSet FallbackTerminals = new TerminalSet()
 
Type DefaultNodeType
 
NonTerminal Root
 The main root entry for the grammar. More...
 
Func< ScannerScannerBuilder
 
NonTerminalSet SnippetRoots = new NonTerminalSet()
 
string GrammarComments
 
CultureInfo DefaultCulture = CultureInfo.InvariantCulture
 
string ConsoleTitle
 
string ConsoleGreeting
 
string ConsolePrompt
 
string ConsolePromptMoreInput
 
readonly Terminal Empty = new Terminal("EMPTY")
 
readonly Terminal NewLine = new Terminal("LF")
 
readonly Terminal Indent = new Terminal("INDENT", TokenCategory.Outline, TermFlags.IsNonScanner)
 
readonly Terminal Dedent = new Terminal("DEDENT", TokenCategory.Outline, TermFlags.IsNonScanner)
 
readonly Terminal Eos = new Terminal("EOS", Resources.LabelEosLabel, TokenCategory.Outline, TermFlags.IsNonScanner)
 
readonly Terminal Eof = new Terminal("EOF", TokenCategory.Outline)
 
readonly Terminal LineStartTerminal = new Terminal("LINE_START", TokenCategory.Outline)
 
readonly Terminal SyntaxError = new Terminal("SYNTAX_ERROR", TokenCategory.Error, TermFlags.IsNonScanner)
 
KeyTermTable KeyTerms
 

Protected Member Functions

GrammarHint PreferShiftHere ()
 
GrammarHint ReduceHere ()
 
GrammarHint ResolveInCode ()
 
TokenPreviewHint ReduceIf (string symbol)
 
TokenPreviewHint ShiftIf (string symbol)
 
GrammarHint ImplyPrecedenceHere (int precedence)
 
GrammarHint ImplyPrecedenceHere (int precedence, Associativity associativity)
 
void AddTermsReportGroup (string alias, params string[] symbols)
 Creates a terminal reporting group, so all terminals in the group will be reported as a single "alias" in syntex error messages like "Syntax error, expected: [list of terms]" More...
 
void AddTermsReportGroup (string alias, params Terminal[] terminals)
 Creates a terminal reporting group, so all terminals in the group will be reported as a single "alias" in syntex error messages like "Syntax error, expected: [list of terms]" More...
 
void AddToNoReportGroup (params string[] symbols)
 Adds symbols to a group with no-report type, so symbols will not be shown in expected lists in syntax error messages. More...
 
void AddToNoReportGroup (params Terminal[] terminals)
 Adds symbols to a group with no-report type, so symbols will not be shown in expected lists in syntax error messages. More...
 
void AddOperatorReportGroup (string alias)
 Adds a group and an alias for all operator symbols used in the grammar. More...
 

Properties

NonTerminal NewLinePlus [get]
 
NonTerminal NewLineStar [get]
 
static Grammar CurrentGrammar [get]
 

Detailed Description

Definition at line 20 of file Grammar.cs.

Constructor & Destructor Documentation

Irony.Parsing.Grammar.Grammar ( )

Definition at line 96 of file Grammar.cs.

Irony.Parsing.Grammar.Grammar ( bool  caseSensitive)

Member Function Documentation

void Irony.Parsing.Grammar.AddOperatorReportGroup ( string  alias)
protected

Adds a group and an alias for all operator symbols used in the grammar.

Parameters
aliasAn alias for operator symbols.

Definition at line 397 of file Grammar.cs.

void Irony.Parsing.Grammar.AddTermsReportGroup ( string  alias,
params string[]  symbols 
)
protected

Creates a terminal reporting group, so all terminals in the group will be reported as a single "alias" in syntex error messages like "Syntax error, expected: [list of terms]"

Parameters
aliasAn alias for all terminals in the group.
symbolsSymbols to be included into the group.

Definition at line 367 of file Grammar.cs.

void Irony.Parsing.Grammar.AddTermsReportGroup ( string  alias,
params Terminal[]  terminals 
)
protected

Creates a terminal reporting group, so all terminals in the group will be reported as a single "alias" in syntex error messages like "Syntax error, expected: [list of terms]"

Parameters
aliasAn alias for all terminals in the group.
terminalsTerminals to be included into the group.

Definition at line 376 of file Grammar.cs.

void Irony.Parsing.Grammar.AddToNoReportGroup ( params string[]  symbols)
protected

Adds symbols to a group with no-report type, so symbols will not be shown in expected lists in syntax error messages.

Parameters
symbolsSymbols to exclude.

Definition at line 383 of file Grammar.cs.

void Irony.Parsing.Grammar.AddToNoReportGroup ( params Terminal[]  terminals)
protected

Adds symbols to a group with no-report type, so symbols will not be shown in expected lists in syntax error messages.

Parameters
symbolsSymbols to exclude.

Definition at line 390 of file Grammar.cs.

virtual string Irony.Parsing.Grammar.ConstructParserErrorMessage ( ParsingContext  context,
StringSet  expectedTerms 
)
virtual

Definition at line 245 of file Grammar.cs.

References Irony.Resources.ErrParserUnexpInput.

virtual void Irony.Parsing.Grammar.CreateAstNode ( ParsingContext  context,
ParseTreeNode  nodeInfo 
)
virtual

Definition at line 216 of file Grammar.cs.

virtual LanguageData Irony.Parsing.Grammar.CreateLanguageData ( )
virtual

Reimplemented in SiliconStudio.Shaders.Grammar.Hlsl.HlslGrammar.

Definition at line 91 of file Grammar.cs.

virtual void Irony.Parsing.Grammar.CreateTokenFilters ( LanguageData  language,
TokenFilterList  filters 
)
virtual

Definition at line 192 of file Grammar.cs.

bool Irony.Parsing.Grammar.FlagIsSet ( LanguageFlags  flag)
virtual string Irony.Parsing.Grammar.GetParseNodeCaption ( ParseTreeNode  node)
virtual
GrammarHint Irony.Parsing.Grammar.ImplyPrecedenceHere ( int  precedence)
protected

Definition at line 348 of file Grammar.cs.

GrammarHint Irony.Parsing.Grammar.ImplyPrecedenceHere ( int  precedence,
Associativity  associativity 
)
protected

Definition at line 351 of file Grammar.cs.

static BnfExpression Irony.Parsing.Grammar.MakePlusRule ( NonTerminal  listNonTerminal,
BnfTerm  listMember 
)
static

Definition at line 274 of file Grammar.cs.

static BnfExpression Irony.Parsing.Grammar.MakePlusRule ( NonTerminal  listNonTerminal,
BnfTerm  delimiter,
BnfTerm  listMember,
TermListOptions  options 
)
static

Definition at line 278 of file Grammar.cs.

References Irony.Parsing.BnfTerm.Name.

static BnfExpression Irony.Parsing.Grammar.MakePlusRule ( NonTerminal  listNonTerminal,
BnfTerm  delimiter,
BnfTerm  listMember 
)
static

Definition at line 290 of file Grammar.cs.

static BnfExpression Irony.Parsing.Grammar.MakeStarRule ( NonTerminal  listNonTerminal,
BnfTerm  listMember 
)
static

Definition at line 299 of file Grammar.cs.

static BnfExpression Irony.Parsing.Grammar.MakeStarRule ( NonTerminal  listNonTerminal,
BnfTerm  delimiter,
BnfTerm  listMember 
)
static

Definition at line 303 of file Grammar.cs.

static BnfExpression Irony.Parsing.Grammar.MakeStarRule ( NonTerminal  listNonTerminal,
BnfTerm  delimiter,
BnfTerm  listMember,
TermListOptions  options 
)
static

Definition at line 307 of file Grammar.cs.

References Irony.Parsing.BnfTerm.Name.

void Irony.Parsing.Grammar.MarkMemberSelect ( params string[]  symbols)

Definition at line 174 of file Grammar.cs.

void Irony.Parsing.Grammar.MarkNotReported ( params BnfTerm[]  terms)

Definition at line 180 of file Grammar.cs.

void Irony.Parsing.Grammar.MarkNotReported ( params string[]  symbols)

Definition at line 184 of file Grammar.cs.

void Irony.Parsing.Grammar.MarkPunctuation ( params string[]  symbols)

Definition at line 156 of file Grammar.cs.

void Irony.Parsing.Grammar.MarkPunctuation ( params BnfTerm[]  terms)

Definition at line 163 of file Grammar.cs.

void Irony.Parsing.Grammar.MarkReservedWords ( params string[]  reservedWords)

Definition at line 114 of file Grammar.cs.

void Irony.Parsing.Grammar.MarkTransient ( params NonTerminal[]  nonTerminals)

Definition at line 169 of file Grammar.cs.

virtual void Irony.Parsing.Grammar.OnGrammarDataConstructed ( LanguageData  language)
virtual

Definition at line 236 of file Grammar.cs.

virtual void Irony.Parsing.Grammar.OnLanguageDataConstructed ( LanguageData  language)
virtual

Definition at line 239 of file Grammar.cs.

virtual void Irony.Parsing.Grammar.OnResolvingConflict ( ConflictResolutionArgs  args)
virtual

Override this method to provide custom conflict resolution; for example, custom code may decide proper shift or reduce action based on preview of tokens ahead.

Definition at line 231 of file Grammar.cs.

virtual void Irony.Parsing.Grammar.OnScannerSelectTerminal ( ParsingContext  context)
virtual

Override this method to help scanner select a terminal to create token when there are more than one candidates for an input char. Context.CurrentTerminals contains candidate terminals; leave a single terminal in this list as the one to use.

Definition at line 225 of file Grammar.cs.

GrammarHint Irony.Parsing.Grammar.PreferShiftHere ( )
protected

Definition at line 333 of file Grammar.cs.

GrammarHint Irony.Parsing.Grammar.ReduceHere ( )
protected

Definition at line 336 of file Grammar.cs.

TokenPreviewHint Irony.Parsing.Grammar.ReduceIf ( string  symbol)
protected

Definition at line 342 of file Grammar.cs.

void Irony.Parsing.Grammar.RegisterBracePair ( string  openBrace,
string  closeBrace 
)

Definition at line 147 of file Grammar.cs.

void Irony.Parsing.Grammar.RegisterOperators ( int  precedence,
params string[]  opSymbols 
)

Definition at line 123 of file Grammar.cs.

void Irony.Parsing.Grammar.RegisterOperators ( int  precedence,
Associativity  associativity,
params string[]  opSymbols 
)

Definition at line 127 of file Grammar.cs.

void Irony.Parsing.Grammar.RegisterOperators ( int  precedence,
params BnfTerm[]  opTerms 
)

Definition at line 136 of file Grammar.cs.

void Irony.Parsing.Grammar.RegisterOperators ( int  precedence,
Associativity  associativity,
params BnfTerm[]  opTerms 
)

Definition at line 139 of file Grammar.cs.

GrammarHint Irony.Parsing.Grammar.ResolveInCode ( )
protected

Definition at line 339 of file Grammar.cs.

TokenPreviewHint Irony.Parsing.Grammar.ShiftIf ( string  symbol)
protected

Definition at line 345 of file Grammar.cs.

KeyTerm Irony.Parsing.Grammar.ToTerm ( string  text)
KeyTerm Irony.Parsing.Grammar.ToTerm ( string  text,
string  name 
)

Definition at line 463 of file Grammar.cs.

virtual Token Irony.Parsing.Grammar.TryMatch ( ParsingContext  context,
ISourceStream  source 
)
virtual

Definition at line 196 of file Grammar.cs.

Member Data Documentation

readonly bool Irony.Parsing.Grammar.CaseSensitive = true

Gets case sensitivity of the grammar. Read-only, true by default. Can be set to false only through a parameter to grammar constructor.

Definition at line 27 of file Grammar.cs.

Referenced by Irony.Parsing.QuotedValueLiteral.ReadBody(), Irony.Parsing.ConstantTerminal.TryMatch(), and Irony.Parsing.KeyTerm.TryMatch().

string Irony.Parsing.Grammar.ConsoleGreeting

Definition at line 83 of file Grammar.cs.

string Irony.Parsing.Grammar.ConsolePrompt

Definition at line 84 of file Grammar.cs.

string Irony.Parsing.Grammar.ConsolePromptMoreInput

Definition at line 85 of file Grammar.cs.

string Irony.Parsing.Grammar.ConsoleTitle

Definition at line 82 of file Grammar.cs.

readonly Terminal Irony.Parsing.Grammar.Dedent = new Terminal("DEDENT", TokenCategory.Outline, TermFlags.IsNonScanner)

Definition at line 417 of file Grammar.cs.

CultureInfo Irony.Parsing.Grammar.DefaultCulture = CultureInfo.InvariantCulture

Definition at line 79 of file Grammar.cs.

Type Irony.Parsing.Grammar.DefaultNodeType

Definition at line 62 of file Grammar.cs.

string Irony.Parsing.Grammar.Delimiters = null

Definition at line 32 of file Grammar.cs.

readonly Terminal Irony.Parsing.Grammar.Empty = new Terminal("EMPTY")

Definition at line 412 of file Grammar.cs.

readonly Terminal Irony.Parsing.Grammar.Eof = new Terminal("EOF", TokenCategory.Outline)
readonly Terminal Irony.Parsing.Grammar.Eos = new Terminal("EOS", Resources.LabelEosLabel, TokenCategory.Outline, TermFlags.IsNonScanner)

Definition at line 421 of file Grammar.cs.

readonly TerminalSet Irony.Parsing.Grammar.FallbackTerminals = new TerminalSet()

Definition at line 60 of file Grammar.cs.

string Irony.Parsing.Grammar.GrammarComments

Definition at line 77 of file Grammar.cs.

readonly Terminal Irony.Parsing.Grammar.Indent = new Terminal("INDENT", TokenCategory.Outline, TermFlags.IsNonScanner)

Definition at line 416 of file Grammar.cs.

KeyTermTable Irony.Parsing.Grammar.KeyTerms
LanguageFlags Irony.Parsing.Grammar.LanguageFlags = LanguageFlags.Default

Definition at line 40 of file Grammar.cs.

readonly StringComparer Irony.Parsing.Grammar.LanguageStringComparer

Definition at line 28 of file Grammar.cs.

readonly Terminal Irony.Parsing.Grammar.LineStartTerminal = new Terminal("LINE_START", TokenCategory.Outline)

Definition at line 428 of file Grammar.cs.

string Irony.Parsing.Grammar.LineTerminators = "\n\r\v"

Definition at line 37 of file Grammar.cs.

readonly Terminal Irony.Parsing.Grammar.NewLine = new Terminal("LF")

Definition at line 415 of file Grammar.cs.

readonly TerminalSet Irony.Parsing.Grammar.NonGrammarTerminals = new TerminalSet()

Definition at line 52 of file Grammar.cs.

NonTerminal Irony.Parsing.Grammar.Root

The main root entry for the grammar.

Definition at line 68 of file Grammar.cs.

Func<Scanner> Irony.Parsing.Grammar.ScannerBuilder

Definition at line 70 of file Grammar.cs.

NonTerminalSet Irony.Parsing.Grammar.SnippetRoots = new NonTerminalSet()

Alternative roots for parsing code snippets.

Definition at line 75 of file Grammar.cs.

Referenced by Irony.Parsing.StringLiteral.Init().

readonly Terminal Irony.Parsing.Grammar.SyntaxError = new Terminal("SYNTAX_ERROR", TokenCategory.Error, TermFlags.IsNonScanner)

Definition at line 431 of file Grammar.cs.

TermReportGroupList Irony.Parsing.Grammar.TermReportGroups = new TermReportGroupList()

Definition at line 46 of file Grammar.cs.

string Irony.Parsing.Grammar.WhitespaceChars = " \t\r\n\v"

Definition at line 34 of file Grammar.cs.

Referenced by Irony.Parsing.DefaultScanner.NextToken().

Property Documentation

Grammar Irony.Parsing.Grammar.CurrentGrammar
staticget
NonTerminal Irony.Parsing.Grammar.NewLinePlus
get

Definition at line 433 of file Grammar.cs.

NonTerminal Irony.Parsing.Grammar.NewLineStar
get

Definition at line 444 of file Grammar.cs.


The documentation for this class was generated from the following file: