C# Class GraphView.GraphViewParser

The parser first extracts all tokens containing MATCH clauses, then replace them with multiline comment. The original parser will parse remaining tokens and return a syntax tree. Finally, MATCH clauses are inserted into appropriate QueryBlock by traversing the syntax tree.
显示文件 Open project: Microsoft/GraphView Class Usage Examples

Public Methods

Method Description
GraphViewParser ( ) : System
Parse ( TextReader queryInput, IList &errors ) : WSqlFragment

Parses a GraphView query into a syntax tree. The parser re-uses the T-SQL parser by masking graph-extended query constructs with comments first and then putting them back into the syntax tree.

ParseAlterTableAddNodeTableColumnStatement ( string queryStr, List &nodeTableColumns, IList &errors ) : WSqlFragment

Parses a ALTER TABLE ADD PROPERTY/EDGE statement. The parser first replaces column annotations with white space, then uses T-SQL parser to parse it, and finally interprets the column annotations.

ParseAlterTableDropNodeTableColumnStatement ( string queryStr, IList &errors ) : WSqlFragment

Parses a ALTER TABLE DROP COLUMN statement.

ParseCreateNodeEdgeViewStatement ( string query, IList &errors ) : WSqlFragment
ParseCreateNodeTableStatement ( string queryStr, List &nodeTableColumns, IList &errors ) : WSqlFragment

Parses a CREATE TABLE statement. The parser first replaces column annotations with white space, then uses T-SQL parser to parse it, and finally interprets the column annotations.

Private Methods

Method Description
ExtractMatchClause ( ) : void
FindReplaceGraphModificationStatements ( IList &errors ) : List

Finds all graph modification statements (INSERT NODE, INSERT EDGE, DELETE NODE, DELETE EDGE), records their positions in the script as a list of annotations, and replaces them by INSERT and DELETE, so that the token list can be parsed by the T-SQL parser.

ParseDataType ( IList tokens, int &nextToken, GraphView.WDataTypeReference &result, int &farestError ) : bool
ParseIdentifier ( IList tokens, int &nextToken, Identifier &result, int &farestError ) : bool
ParseIntegerLiteral ( IList tokens, int &nextToken, Literal &result, int &farestError ) : bool
ParseLiteralList ( IList tokens, int &nextToken, List &result, int &farestError ) : bool
ParseMatchClause ( IList tokens, int &nextToken, WMatchClause &result, int &farestError ) : bool
ParseMatchPath ( IList tokens, int &nextToken, WMatchPath &result, int &farestError ) : bool
ParseMatchPathEdge ( IList tokens, int &nextToken, WEdgeColumnReferenceExpression &result, int &farestError ) : bool
ParseMatchPathPart ( IList tokens, int &nextToken, WEdgeColumnReferenceExpression>.Tuple &result, int &farestError ) : bool
ParseMaxLiteral ( IList tokens, int &nextToken, Literal &result, int &farestError ) : bool
ParseMultiPartIdentifier ( IList tokens, int &nextToken, WMultiPartIdentifier &result, int &farestError ) : bool
ParseNestedObject ( List tokenList, int &nextToken, NestedObject &result, int &fareastError, bool supportMoreFieldType = false ) : bool
ParseNodeTableColumn ( IList tokens, int &nextToken, GraphView.WNodeTableColumn &result, int &farestError ) : bool
ParseParameterizedDataType ( IList tokens, int &nextToken, GraphView.WDataTypeReference &result, int &farestError ) : bool
ParseQuotedIdentifier ( IList tokens, int &nextToken, Identifier &result, int &farestError ) : bool
ParseSchemaObjectName ( IList tokens, int &nextToken, WSchemaObjectName &result, int &farestError ) : bool
ReadToken ( IList tokens, TSqlTokenType type, string &result, int &nextToken, int &farestError ) : bool
ReadToken ( IList tokens, string value, int &nextToken, int &farestError ) : bool
ReadToken ( List tokens, AnnotationTokenType type, int &nextToken, string &tokenValue, int &fareastError ) : bool
ReadToken ( List tokens, string text, int &nextToken, string &tokenValue, int &fareastError ) : bool

Method Details

GraphViewParser() public method

public GraphViewParser ( ) : System
return System

Parse() public method

Parses a GraphView query into a syntax tree. The parser re-uses the T-SQL parser by masking graph-extended query constructs with comments first and then putting them back into the syntax tree.
public Parse ( TextReader queryInput, IList &errors ) : WSqlFragment
queryInput TextReader The query string
errors IList A list of parsing errors
return WSqlFragment

ParseAlterTableAddNodeTableColumnStatement() public method

Parses a ALTER TABLE ADD PROPERTY/EDGE statement. The parser first replaces column annotations with white space, then uses T-SQL parser to parse it, and finally interprets the column annotations.
public ParseAlterTableAddNodeTableColumnStatement ( string queryStr, List &nodeTableColumns, IList &errors ) : WSqlFragment
queryStr string The CREATE TABLE statement creating a ndoe table
nodeTableColumns List A list of columns of the node table
errors IList Parsing errors
return WSqlFragment

ParseAlterTableDropNodeTableColumnStatement() public method

Parses a ALTER TABLE DROP COLUMN statement.
public ParseAlterTableDropNodeTableColumnStatement ( string queryStr, IList &errors ) : WSqlFragment
queryStr string The CREATE TABLE statement creating a ndoe table
errors IList Parsing errors
return WSqlFragment

ParseCreateNodeEdgeViewStatement() public method

public ParseCreateNodeEdgeViewStatement ( string query, IList &errors ) : WSqlFragment
query string
errors IList
return WSqlFragment

ParseCreateNodeTableStatement() public method

Parses a CREATE TABLE statement. The parser first replaces column annotations with white space, then uses T-SQL parser to parse it, and finally interprets the column annotations.
public ParseCreateNodeTableStatement ( string queryStr, List &nodeTableColumns, IList &errors ) : WSqlFragment
queryStr string The CREATE TABLE statement creating a ndoe table
nodeTableColumns List A list of columns of the node table
errors IList Parsing errors
return WSqlFragment