C# Class _3PA.MainFeatures.Parser.Parser

This class is not actually a parser "per say" but it extracts important information from the tokens created by the lexer
Mostra file Open project: jcaillon/3P

Public Methods

Method Description
Accept ( IParserVisitor visitor ) : void

Feed this method with a visitor implementing IParserVisitor to visit all the parsed items

Parser ( ) : System
Parser ( Lexer lexer, string filePathBeingParsed, ParsedScopeItem defaultScope, bool matchKnownWords = false ) : System

Parses a text into a list of parsedItems

Parser ( string data, string filePathBeingParsed, ParsedScopeItem defaultScope, bool matchKnownWords = false ) : System

Constructor with a string instead of a lexer

UpdateKnownStaticItems ( ) : void

Private Methods

Method Description
AddParsedItem ( ParsedItem item ) : void

Call this method instead of adding the items directly in the list, updates the scope and file name

AddTokenToStringBuilder ( StringBuilder strBuilder, Token token ) : void

Append a token value to the StringBuilder, avoid adding too much spaces and new lines

Analyze ( ) : void
CreateParsedDefine ( Token functionToken, bool isDynamic ) : void

Matches a new definition

CreateParsedDynamicFunction ( Token tokenFun ) : void

Creates a dynamic function parsed item

CreateParsedFunction ( Token functionToken ) : bool

Matches a function definition (not the FORWARD prototype)

CreateParsedIfEndIfPreProc ( Token ifToken ) : ParsedPreProcBlock

Matches a & IF.. & THEN pre-processed statement

CreateParsedIncludeFile ( Token token ) : void

matches a include file

CreateParsedLabel ( ) : void

Creates a label parsed item

CreateParsedOnEvent ( Token onToken ) : void

Creates parsed item for ON CHOOSE OF XXX events (choose or anything else)

CreateParsedPreProc ( Token token ) : void

Analyze a preprocessed statement

CreateParsedProcedure ( Token procToken ) : bool

Matches a procedure definition

CreateParsedRun ( Token runToken ) : void

Creates a parsed item for RUN statements

GetCurrentDepth ( ) : int

Returns the current block depth

GetParsedParameters ( Token functionToken, StringBuilder parameters ) : List

Parses a parameter definition (used in function, class method, class event)

GetTokenStrippedValue ( Token token ) : string

Returns token value or token value minus starting/ending quote of the token is a string

MoveNext ( ) : bool

Go to the next token

NewLexerFromData ( string data ) : Lexer
NewStatement ( Token token ) : void

called when a Eos token is found, store information on the statement's line

PeekAt ( int x ) : Token

Peek forward x tokens, returns an TokenEof if out of limits

PeekAtNextNonSpace ( int start, bool goBackward = false ) : Token

Peek forward (or backward if goBackWard = true) until we match a token that is not a space token return found token

PushBlockInfoToStack ( IndentType indentType, int currentLine ) : void

Add a block info on top of the block Stack

Method Details

Accept() public method

Feed this method with a visitor implementing IParserVisitor to visit all the parsed items
public Accept ( IParserVisitor visitor ) : void
visitor IParserVisitor
return void

Parser() public method

public Parser ( ) : System
return System

Parser() public method

Parses a text into a list of parsedItems
public Parser ( Lexer lexer, string filePathBeingParsed, ParsedScopeItem defaultScope, bool matchKnownWords = false ) : System
lexer Lexer
filePathBeingParsed string
defaultScope ParsedScopeItem
matchKnownWords bool
return System

Parser() public method

Constructor with a string instead of a lexer
public Parser ( string data, string filePathBeingParsed, ParsedScopeItem defaultScope, bool matchKnownWords = false ) : System
data string
filePathBeingParsed string
defaultScope ParsedScopeItem
matchKnownWords bool
return System

UpdateKnownStaticItems() public static method

public static UpdateKnownStaticItems ( ) : void
return void