[torque] a new self-contained parser for torque
Bug: v8:7793 Change-Id: I208edf856f0283d840358f3c11bab97af0397056 Reviewed-on: https://chromium-review.googlesource.com/1095192 Reviewed-by: Daniel Clifford <danno@chromium.org> Reviewed-by: Jaroslav Sevcik <jarin@chromium.org> Commit-Queue: Tobias Tebbi <tebbi@chromium.org> Cr-Commit-Position: refs/heads/master@{#54574}
This commit is contained in:
parent
0ff83e9799
commit
ed6b11d53f
31
BUILD.gn
31
BUILD.gn
@ -3143,24 +3143,7 @@ if (current_toolchain == v8_snapshot_toolchain) {
|
||||
v8_executable("torque") {
|
||||
visibility = [ ":*" ] # Only targets in this file can depend on this.
|
||||
|
||||
defines = [ "ANTLR4CPP_STATIC" ]
|
||||
|
||||
include_dirs = [
|
||||
"third_party/antlr4/runtime/Cpp/runtime/src",
|
||||
"src/torque",
|
||||
]
|
||||
|
||||
sources = [
|
||||
"src/torque/TorqueBaseVisitor.cpp",
|
||||
"src/torque/TorqueBaseVisitor.h",
|
||||
"src/torque/TorqueLexer.cpp",
|
||||
"src/torque/TorqueLexer.h",
|
||||
"src/torque/TorqueParser.cpp",
|
||||
"src/torque/TorqueParser.h",
|
||||
"src/torque/TorqueVisitor.cpp",
|
||||
"src/torque/TorqueVisitor.h",
|
||||
"src/torque/ast-generator.cc",
|
||||
"src/torque/ast-generator.h",
|
||||
"src/torque/ast.h",
|
||||
"src/torque/contextual.h",
|
||||
"src/torque/declarable.cc",
|
||||
@ -3169,6 +3152,8 @@ if (current_toolchain == v8_snapshot_toolchain) {
|
||||
"src/torque/declaration-visitor.h",
|
||||
"src/torque/declarations.cc",
|
||||
"src/torque/declarations.h",
|
||||
"src/torque/earley-parser.cc",
|
||||
"src/torque/earley-parser.h",
|
||||
"src/torque/file-visitor.cc",
|
||||
"src/torque/file-visitor.h",
|
||||
"src/torque/global-context.h",
|
||||
@ -3176,6 +3161,9 @@ if (current_toolchain == v8_snapshot_toolchain) {
|
||||
"src/torque/implementation-visitor.h",
|
||||
"src/torque/scope.cc",
|
||||
"src/torque/scope.h",
|
||||
"src/torque/source-positions.h",
|
||||
"src/torque/torque-parser.cc",
|
||||
"src/torque/torque-parser.h",
|
||||
"src/torque/torque.cc",
|
||||
"src/torque/type-oracle.h",
|
||||
"src/torque/types.cc",
|
||||
@ -3186,19 +3174,10 @@ if (current_toolchain == v8_snapshot_toolchain) {
|
||||
|
||||
deps = [
|
||||
":v8_libbase",
|
||||
"third_party/antlr4:antlr4",
|
||||
"//build/win:default_exe_manifest",
|
||||
]
|
||||
|
||||
remove_configs = [
|
||||
"//build/config/compiler:no_rtti",
|
||||
"//build/config/compiler:no_exceptions",
|
||||
]
|
||||
|
||||
configs = [
|
||||
"//build/config/compiler:rtti",
|
||||
"//build/config/compiler:exceptions",
|
||||
"third_party/antlr4:antlr-compatibility",
|
||||
":external_config",
|
||||
":internal_config_base",
|
||||
]
|
||||
|
@ -113,6 +113,12 @@ V8_INLINE Dest bit_cast(Source const& source) {
|
||||
TypeName(const TypeName&) = delete; \
|
||||
DISALLOW_ASSIGN(TypeName)
|
||||
|
||||
// Explicitly declare all copy/move constructors and assignments as deleted.
|
||||
#define DISALLOW_COPY_AND_MOVE_AND_ASSIGN(TypeName) \
|
||||
TypeName(TypeName&&) = delete; \
|
||||
TypeName& operator=(TypeName&&) = delete; \
|
||||
DISALLOW_COPY_AND_ASSIGN(TypeName)
|
||||
|
||||
// Explicitly declare all implicit constructors as deleted, namely the
|
||||
// default constructor, copy constructor and operator= functions.
|
||||
// This is especially useful for classes containing only static methods.
|
||||
|
@ -280,8 +280,14 @@ extern operator '|' macro Word32Or(uint32, uint32): uint32;
|
||||
|
||||
extern operator '+' macro NumberAdd(Number, Number): Number;
|
||||
extern operator '-' macro NumberSub(Number, Number): Number;
|
||||
extern operator 'min' macro NumberMin(Number, Number): Number;
|
||||
extern operator 'max' macro NumberMax(Number, Number): Number;
|
||||
extern macro NumberMin(Number, Number): Number;
|
||||
extern macro NumberMax(Number, Number): Number;
|
||||
macro min(x: Number, y : Number) : Number {
|
||||
return NumberMin(x,y);
|
||||
}
|
||||
macro max(x: Number, y : Number) : Number {
|
||||
return NumberMax(x,y);
|
||||
}
|
||||
|
||||
extern operator '!' macro ConstexprBoolNot(constexpr bool): constexpr bool;
|
||||
extern operator '!' macro Word32BinaryNot(bool): bool;
|
||||
@ -709,7 +715,9 @@ extern macro Typeof(Object): Object;
|
||||
|
||||
// Return true iff number is NaN.
|
||||
macro NumberIsNaN(number: Number): bool {
|
||||
if (TaggedIsSmi(number)) return false;
|
||||
if (TaggedIsSmi(number)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let value: float64 = convert<float64>(unsafe_cast<HeapNumber>(number));
|
||||
return value != value;
|
||||
|
@ -1,315 +0,0 @@
|
||||
// Copyright 2018 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
grammar Torque;
|
||||
|
||||
options {
|
||||
language=Cpp;
|
||||
}
|
||||
|
||||
// parser rules start with lowercase letters, lexer rules with uppercase
|
||||
MACRO: 'macro';
|
||||
BUILTIN: 'builtin';
|
||||
RUNTIME: 'runtime';
|
||||
MODULE: 'module';
|
||||
JAVASCRIPT: 'javascript';
|
||||
DEFERRED: 'deferred';
|
||||
IF: 'if';
|
||||
FOR: 'for';
|
||||
WHILE: 'while';
|
||||
RETURN: 'return';
|
||||
CONSTEXPR: 'constexpr';
|
||||
CONTINUE: 'continue';
|
||||
BREAK: 'break';
|
||||
GOTO: 'goto';
|
||||
OTHERWISE: 'otherwise';
|
||||
TRY: 'try';
|
||||
LABEL: 'label';
|
||||
LABELS: 'labels';
|
||||
TAIL: 'tail';
|
||||
ISNT: 'isnt';
|
||||
IS: 'is';
|
||||
LET: 'let';
|
||||
CONST: 'const';
|
||||
EXTERN: 'extern';
|
||||
ASSERT_TOKEN: 'assert';
|
||||
CHECK_TOKEN: 'check';
|
||||
UNREACHABLE_TOKEN: 'unreachable';
|
||||
DEBUG_TOKEN: 'debug';
|
||||
|
||||
ASSIGNMENT: '=';
|
||||
ASSIGNMENT_OPERATOR
|
||||
: '*='
|
||||
| '/='
|
||||
| '%='
|
||||
| '+='
|
||||
| '-='
|
||||
| '<<='
|
||||
| '>>='
|
||||
| '>>>='
|
||||
| '&='
|
||||
| '^='
|
||||
| '|='
|
||||
;
|
||||
|
||||
EQUAL: '==';
|
||||
PLUS: '+';
|
||||
MINUS: '-';
|
||||
MULTIPLY: '*';
|
||||
DIVIDE: '/';
|
||||
MODULO: '%';
|
||||
BIT_OR: '|';
|
||||
BIT_AND: '&';
|
||||
BIT_NOT: '~';
|
||||
MAX: 'max';
|
||||
MIN: 'min';
|
||||
NOT_EQUAL: '!=';
|
||||
LESS_THAN: '<';
|
||||
LESS_THAN_EQUAL: '<=';
|
||||
GREATER_THAN: '>';
|
||||
GREATER_THAN_EQUAL: '>=';
|
||||
SHIFT_LEFT: '<<';
|
||||
SHIFT_RIGHT: '>>';
|
||||
SHIFT_RIGHT_ARITHMETIC: '>>>';
|
||||
VARARGS: '...';
|
||||
|
||||
EQUALITY_OPERATOR: EQUAL | NOT_EQUAL;
|
||||
|
||||
INCREMENT: '++';
|
||||
DECREMENT: '--';
|
||||
NOT: '!';
|
||||
|
||||
STRING_LITERAL : ('"' ( ESCAPE | ~('"' | '\\' | '\n' | '\r') ) * '"')
|
||||
| ('\'' ( ESCAPE | ~('\'' | '\\' | '\n' | '\r') ) * '\'');
|
||||
fragment ESCAPE : '\\' ( '\'' | '\\' | '"' | 'n' | 'r' );
|
||||
|
||||
IDENTIFIER : [A-Za-z][0-9A-Za-z_]* ;
|
||||
|
||||
WS : [ \t\r\n\f]+ -> channel(HIDDEN);
|
||||
|
||||
BLOCK_COMMENT
|
||||
: '/*' .*? ('*/' | EOF) -> channel(HIDDEN)
|
||||
;
|
||||
|
||||
LINE_COMMENT
|
||||
: '//' ~[\r\n]* -> channel(HIDDEN)
|
||||
;
|
||||
|
||||
fragment DECIMAL_DIGIT
|
||||
: [0-9]
|
||||
;
|
||||
|
||||
fragment DECIMAL_INTEGER_LITERAL
|
||||
: '0'
|
||||
| [1-9] DECIMAL_DIGIT*
|
||||
;
|
||||
|
||||
fragment EXPONENT_PART
|
||||
: [eE] [+-]? DECIMAL_DIGIT+
|
||||
;
|
||||
|
||||
DECIMAL_LITERAL
|
||||
: MINUS? DECIMAL_INTEGER_LITERAL '.' DECIMAL_DIGIT* EXPONENT_PART?
|
||||
| MINUS? '.' DECIMAL_DIGIT+ EXPONENT_PART?
|
||||
| MINUS? DECIMAL_INTEGER_LITERAL EXPONENT_PART?
|
||||
| MINUS? '0x' [0-9a-fA-F]+
|
||||
;
|
||||
|
||||
type : CONSTEXPR? IDENTIFIER
|
||||
| BUILTIN '(' typeList ')' '=>' type
|
||||
| type BIT_OR type
|
||||
| '(' type ')'
|
||||
;
|
||||
|
||||
typeList : (type (',' type)*)?;
|
||||
genericSpecializationTypeList: '<' typeList '>';
|
||||
|
||||
optionalGenericTypeList: ('<' IDENTIFIER ':' 'type' (',' IDENTIFIER ':' 'type')* '>')?;
|
||||
|
||||
typeListMaybeVarArgs: '(' type? (',' type)* (',' VARARGS)? ')'
|
||||
| '(' VARARGS ')';
|
||||
|
||||
labelParameter: IDENTIFIER ( '(' typeList ')' )?;
|
||||
|
||||
optionalType: (':' type)?;
|
||||
optionalLabelList: (LABELS labelParameter (',' labelParameter)*)?;
|
||||
optionalOtherwise: (OTHERWISE IDENTIFIER (',' IDENTIFIER)*)?;
|
||||
|
||||
parameter: IDENTIFIER ':' type?;
|
||||
parameterList
|
||||
: '(' parameter? (',' parameter)* ')'
|
||||
| '(' parameter ',' parameter ',' VARARGS IDENTIFIER ')';
|
||||
labelDeclaration: IDENTIFIER parameterList?;
|
||||
|
||||
expression
|
||||
: conditionalExpression;
|
||||
|
||||
conditionalExpression
|
||||
: logicalORExpression
|
||||
| conditionalExpression '?' logicalORExpression ':' logicalORExpression;
|
||||
|
||||
logicalORExpression
|
||||
: logicalANDExpression
|
||||
| logicalORExpression '||' logicalANDExpression;
|
||||
|
||||
logicalANDExpression
|
||||
: bitwiseExpression
|
||||
| logicalANDExpression '&&' bitwiseExpression;
|
||||
|
||||
bitwiseExpression
|
||||
: equalityExpression
|
||||
| bitwiseExpression op=(BIT_AND | BIT_OR) equalityExpression;
|
||||
|
||||
equalityExpression
|
||||
: relationalExpression
|
||||
| equalityExpression
|
||||
op=(EQUAL | NOT_EQUAL)
|
||||
relationalExpression;
|
||||
|
||||
relationalExpression
|
||||
: shiftExpression
|
||||
| relationalExpression
|
||||
op=(LESS_THAN | LESS_THAN_EQUAL | GREATER_THAN | GREATER_THAN_EQUAL)
|
||||
shiftExpression;
|
||||
|
||||
shiftExpression
|
||||
: additiveExpression
|
||||
| shiftExpression op=(SHIFT_RIGHT | SHIFT_LEFT | SHIFT_RIGHT_ARITHMETIC) additiveExpression;
|
||||
|
||||
additiveExpression
|
||||
: multiplicativeExpression
|
||||
| additiveExpression op=(PLUS | MINUS) multiplicativeExpression;
|
||||
|
||||
multiplicativeExpression
|
||||
: unaryExpression
|
||||
| multiplicativeExpression op=(MULTIPLY | DIVIDE | MODULO) unaryExpression;
|
||||
|
||||
unaryExpression
|
||||
: assignmentExpression
|
||||
| op=(PLUS | MINUS | BIT_NOT | NOT) unaryExpression;
|
||||
|
||||
locationExpression
|
||||
: IDENTIFIER
|
||||
| locationExpression '.' IDENTIFIER
|
||||
| primaryExpression '.' IDENTIFIER
|
||||
| locationExpression '[' expression ']'
|
||||
| primaryExpression '[' expression ']';
|
||||
|
||||
incrementDecrement
|
||||
: INCREMENT locationExpression
|
||||
| DECREMENT locationExpression
|
||||
| locationExpression op=INCREMENT
|
||||
| locationExpression op=DECREMENT
|
||||
;
|
||||
|
||||
assignment
|
||||
: incrementDecrement
|
||||
| locationExpression ((ASSIGNMENT | ASSIGNMENT_OPERATOR) expression)?;
|
||||
|
||||
assignmentExpression
|
||||
: functionPointerExpression
|
||||
| assignment;
|
||||
|
||||
structExpression
|
||||
: IDENTIFIER '{' (expression (',' expression)*)? '}';
|
||||
|
||||
functionPointerExpression
|
||||
: primaryExpression
|
||||
| IDENTIFIER genericSpecializationTypeList?
|
||||
;
|
||||
|
||||
primaryExpression
|
||||
: helperCall
|
||||
| structExpression
|
||||
| DECIMAL_LITERAL
|
||||
| STRING_LITERAL
|
||||
| ('(' expression ')')
|
||||
;
|
||||
|
||||
forInitialization : variableDeclarationWithInitialization?;
|
||||
forLoop: FOR '(' forInitialization ';' expression ';' assignment ')' statementBlock;
|
||||
|
||||
rangeSpecifier: '[' begin=expression? ':' end=expression? ']';
|
||||
forOfRange: rangeSpecifier?;
|
||||
forOfLoop: FOR '(' variableDeclaration 'of' expression forOfRange ')' statementBlock;
|
||||
|
||||
argument: expression;
|
||||
argumentList: '(' argument? (',' argument)* ')';
|
||||
|
||||
helperCall: (MIN | MAX | IDENTIFIER) genericSpecializationTypeList? argumentList optionalOtherwise;
|
||||
|
||||
labelReference: IDENTIFIER;
|
||||
variableDeclaration: (LET | CONST) IDENTIFIER ':' type;
|
||||
variableDeclarationWithInitialization: variableDeclaration (ASSIGNMENT expression)?;
|
||||
helperCallStatement: (TAIL)? helperCall;
|
||||
expressionStatement: assignment;
|
||||
ifStatement: IF CONSTEXPR? '(' expression ')' statementBlock ('else' statementBlock)?;
|
||||
whileLoop: WHILE '(' expression ')' statementBlock;
|
||||
returnStatement: RETURN expression?;
|
||||
breakStatement: BREAK;
|
||||
continueStatement: CONTINUE;
|
||||
gotoStatement: GOTO labelReference argumentList?;
|
||||
handlerWithStatement: LABEL labelDeclaration statementBlock;
|
||||
tryLabelStatement: TRY statementBlock handlerWithStatement+;
|
||||
|
||||
diagnosticStatement: ((ASSERT_TOKEN | CHECK_TOKEN) '(' expression ')') | UNREACHABLE_TOKEN | DEBUG_TOKEN;
|
||||
|
||||
statement : variableDeclarationWithInitialization ';'
|
||||
| helperCallStatement ';'
|
||||
| expressionStatement ';'
|
||||
| returnStatement ';'
|
||||
| breakStatement ';'
|
||||
| continueStatement ';'
|
||||
| gotoStatement ';'
|
||||
| ifStatement
|
||||
| diagnosticStatement ';'
|
||||
| whileLoop
|
||||
| forOfLoop
|
||||
| forLoop
|
||||
| tryLabelStatement
|
||||
;
|
||||
|
||||
statementList : statement*;
|
||||
statementScope : DEFERRED? '{' statementList '}';
|
||||
statementBlock
|
||||
: statement
|
||||
| statementScope;
|
||||
|
||||
helperBody : statementScope;
|
||||
|
||||
fieldDeclaration: IDENTIFIER ':' type ';';
|
||||
fieldListDeclaration: fieldDeclaration*;
|
||||
|
||||
extendsDeclaration: 'extends' IDENTIFIER;
|
||||
generatesDeclaration: 'generates' STRING_LITERAL;
|
||||
constexprDeclaration: 'constexpr' STRING_LITERAL;
|
||||
typeDeclaration : 'type' IDENTIFIER extendsDeclaration? generatesDeclaration? constexprDeclaration?';';
|
||||
typeAliasDeclaration : 'type' IDENTIFIER '=' type ';';
|
||||
|
||||
externalBuiltin : EXTERN JAVASCRIPT? BUILTIN IDENTIFIER optionalGenericTypeList '(' typeList ')' optionalType ';';
|
||||
externalMacro : EXTERN ('operator' STRING_LITERAL)? MACRO IDENTIFIER optionalGenericTypeList typeListMaybeVarArgs optionalType optionalLabelList ';';
|
||||
externalRuntime : EXTERN RUNTIME IDENTIFIER typeListMaybeVarArgs optionalType ';';
|
||||
builtinDeclaration : JAVASCRIPT? BUILTIN IDENTIFIER optionalGenericTypeList parameterList optionalType (helperBody | ';');
|
||||
genericSpecialization: IDENTIFIER genericSpecializationTypeList parameterList optionalType optionalLabelList helperBody;
|
||||
macroDeclaration : ('operator' STRING_LITERAL)? MACRO IDENTIFIER optionalGenericTypeList parameterList optionalType optionalLabelList (helperBody | ';');
|
||||
externConstDeclaration : CONST IDENTIFIER ':' type generatesDeclaration ';';
|
||||
constDeclaration: CONST IDENTIFIER ':' type ASSIGNMENT expression ';';
|
||||
structDeclaration : 'struct' IDENTIFIER '{' fieldListDeclaration '}';
|
||||
|
||||
declaration
|
||||
: structDeclaration
|
||||
| typeDeclaration
|
||||
| typeAliasDeclaration
|
||||
| builtinDeclaration
|
||||
| genericSpecialization
|
||||
| macroDeclaration
|
||||
| externalMacro
|
||||
| externalBuiltin
|
||||
| externalRuntime
|
||||
| externConstDeclaration
|
||||
| constDeclaration;
|
||||
|
||||
moduleDeclaration : MODULE IDENTIFIER '{' declaration* '}';
|
||||
|
||||
file: (moduleDeclaration | declaration)*;
|
File diff suppressed because one or more lines are too long
@ -1,154 +0,0 @@
|
||||
T__0=1
|
||||
T__1=2
|
||||
T__2=3
|
||||
T__3=4
|
||||
T__4=5
|
||||
T__5=6
|
||||
T__6=7
|
||||
T__7=8
|
||||
T__8=9
|
||||
T__9=10
|
||||
T__10=11
|
||||
T__11=12
|
||||
T__12=13
|
||||
T__13=14
|
||||
T__14=15
|
||||
T__15=16
|
||||
T__16=17
|
||||
T__17=18
|
||||
T__18=19
|
||||
T__19=20
|
||||
T__20=21
|
||||
MACRO=22
|
||||
BUILTIN=23
|
||||
RUNTIME=24
|
||||
MODULE=25
|
||||
JAVASCRIPT=26
|
||||
DEFERRED=27
|
||||
IF=28
|
||||
FOR=29
|
||||
WHILE=30
|
||||
RETURN=31
|
||||
CONSTEXPR=32
|
||||
CONTINUE=33
|
||||
BREAK=34
|
||||
GOTO=35
|
||||
OTHERWISE=36
|
||||
TRY=37
|
||||
LABEL=38
|
||||
LABELS=39
|
||||
TAIL=40
|
||||
ISNT=41
|
||||
IS=42
|
||||
LET=43
|
||||
CONST=44
|
||||
EXTERN=45
|
||||
ASSERT_TOKEN=46
|
||||
CHECK_TOKEN=47
|
||||
UNREACHABLE_TOKEN=48
|
||||
DEBUG_TOKEN=49
|
||||
ASSIGNMENT=50
|
||||
ASSIGNMENT_OPERATOR=51
|
||||
EQUAL=52
|
||||
PLUS=53
|
||||
MINUS=54
|
||||
MULTIPLY=55
|
||||
DIVIDE=56
|
||||
MODULO=57
|
||||
BIT_OR=58
|
||||
BIT_AND=59
|
||||
BIT_NOT=60
|
||||
MAX=61
|
||||
MIN=62
|
||||
NOT_EQUAL=63
|
||||
LESS_THAN=64
|
||||
LESS_THAN_EQUAL=65
|
||||
GREATER_THAN=66
|
||||
GREATER_THAN_EQUAL=67
|
||||
SHIFT_LEFT=68
|
||||
SHIFT_RIGHT=69
|
||||
SHIFT_RIGHT_ARITHMETIC=70
|
||||
VARARGS=71
|
||||
EQUALITY_OPERATOR=72
|
||||
INCREMENT=73
|
||||
DECREMENT=74
|
||||
NOT=75
|
||||
STRING_LITERAL=76
|
||||
IDENTIFIER=77
|
||||
WS=78
|
||||
BLOCK_COMMENT=79
|
||||
LINE_COMMENT=80
|
||||
DECIMAL_LITERAL=81
|
||||
'('=1
|
||||
')'=2
|
||||
'=>'=3
|
||||
','=4
|
||||
':'=5
|
||||
'type'=6
|
||||
'?'=7
|
||||
'||'=8
|
||||
'&&'=9
|
||||
'.'=10
|
||||
'['=11
|
||||
']'=12
|
||||
'{'=13
|
||||
'}'=14
|
||||
';'=15
|
||||
'of'=16
|
||||
'else'=17
|
||||
'extends'=18
|
||||
'generates'=19
|
||||
'operator'=20
|
||||
'struct'=21
|
||||
'macro'=22
|
||||
'builtin'=23
|
||||
'runtime'=24
|
||||
'module'=25
|
||||
'javascript'=26
|
||||
'deferred'=27
|
||||
'if'=28
|
||||
'for'=29
|
||||
'while'=30
|
||||
'return'=31
|
||||
'constexpr'=32
|
||||
'continue'=33
|
||||
'break'=34
|
||||
'goto'=35
|
||||
'otherwise'=36
|
||||
'try'=37
|
||||
'label'=38
|
||||
'labels'=39
|
||||
'tail'=40
|
||||
'isnt'=41
|
||||
'is'=42
|
||||
'let'=43
|
||||
'const'=44
|
||||
'extern'=45
|
||||
'assert'=46
|
||||
'check'=47
|
||||
'unreachable'=48
|
||||
'debug'=49
|
||||
'='=50
|
||||
'=='=52
|
||||
'+'=53
|
||||
'-'=54
|
||||
'*'=55
|
||||
'/'=56
|
||||
'%'=57
|
||||
'|'=58
|
||||
'&'=59
|
||||
'~'=60
|
||||
'max'=61
|
||||
'min'=62
|
||||
'!='=63
|
||||
'<'=64
|
||||
'<='=65
|
||||
'>'=66
|
||||
'>='=67
|
||||
'<<'=68
|
||||
'>>'=69
|
||||
'>>>'=70
|
||||
'...'=71
|
||||
'++'=73
|
||||
'--'=74
|
||||
'!'=75
|
@ -1,7 +0,0 @@
|
||||
// Copyright 2018 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Generated from Torque.g4 by ANTLR 4.7.1
|
||||
|
||||
#include "TorqueBaseListener.h"
|
@ -1,373 +0,0 @@
|
||||
// Copyright 2018 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
#ifndef V8_TORQUE_TORQUEBASELISTENER_H_
|
||||
#define V8_TORQUE_TORQUEBASELISTENER_H_
|
||||
|
||||
// Generated from Torque.g4 by ANTLR 4.7.1
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "./antlr4-runtime.h"
|
||||
#include "TorqueListener.h"
|
||||
|
||||
/**
|
||||
* This class provides an empty implementation of TorqueListener,
|
||||
* which can be extended to create a listener which only needs to handle a
|
||||
* subset of the available methods.
|
||||
*/
|
||||
class TorqueBaseListener : public TorqueListener {
|
||||
public:
|
||||
void enterType(TorqueParser::TypeContext* /*ctx*/) override {}
|
||||
void exitType(TorqueParser::TypeContext* /*ctx*/) override {}
|
||||
|
||||
void enterTypeList(TorqueParser::TypeListContext* /*ctx*/) override {}
|
||||
void exitTypeList(TorqueParser::TypeListContext* /*ctx*/) override {}
|
||||
|
||||
void enterGenericSpecializationTypeList(
|
||||
TorqueParser::GenericSpecializationTypeListContext* /*ctx*/) override {}
|
||||
void exitGenericSpecializationTypeList(
|
||||
TorqueParser::GenericSpecializationTypeListContext* /*ctx*/) override {}
|
||||
|
||||
void enterOptionalGenericTypeList(
|
||||
TorqueParser::OptionalGenericTypeListContext* /*ctx*/) override {}
|
||||
void exitOptionalGenericTypeList(
|
||||
TorqueParser::OptionalGenericTypeListContext* /*ctx*/) override {}
|
||||
|
||||
void enterTypeListMaybeVarArgs(
|
||||
TorqueParser::TypeListMaybeVarArgsContext* /*ctx*/) override {}
|
||||
void exitTypeListMaybeVarArgs(
|
||||
TorqueParser::TypeListMaybeVarArgsContext* /*ctx*/) override {}
|
||||
|
||||
void enterLabelParameter(
|
||||
TorqueParser::LabelParameterContext* /*ctx*/) override {}
|
||||
void exitLabelParameter(
|
||||
TorqueParser::LabelParameterContext* /*ctx*/) override {}
|
||||
|
||||
void enterOptionalType(TorqueParser::OptionalTypeContext* /*ctx*/) override {}
|
||||
void exitOptionalType(TorqueParser::OptionalTypeContext* /*ctx*/) override {}
|
||||
|
||||
void enterOptionalLabelList(
|
||||
TorqueParser::OptionalLabelListContext* /*ctx*/) override {}
|
||||
void exitOptionalLabelList(
|
||||
TorqueParser::OptionalLabelListContext* /*ctx*/) override {}
|
||||
|
||||
void enterOptionalOtherwise(
|
||||
TorqueParser::OptionalOtherwiseContext* /*ctx*/) override {}
|
||||
void exitOptionalOtherwise(
|
||||
TorqueParser::OptionalOtherwiseContext* /*ctx*/) override {}
|
||||
|
||||
void enterParameter(TorqueParser::ParameterContext* /*ctx*/) override {}
|
||||
void exitParameter(TorqueParser::ParameterContext* /*ctx*/) override {}
|
||||
|
||||
void enterParameterList(
|
||||
TorqueParser::ParameterListContext* /*ctx*/) override {}
|
||||
void exitParameterList(TorqueParser::ParameterListContext* /*ctx*/) override {
|
||||
}
|
||||
|
||||
void enterLabelDeclaration(
|
||||
TorqueParser::LabelDeclarationContext* /*ctx*/) override {}
|
||||
void exitLabelDeclaration(
|
||||
TorqueParser::LabelDeclarationContext* /*ctx*/) override {}
|
||||
|
||||
void enterExpression(TorqueParser::ExpressionContext* /*ctx*/) override {}
|
||||
void exitExpression(TorqueParser::ExpressionContext* /*ctx*/) override {}
|
||||
|
||||
void enterConditionalExpression(
|
||||
TorqueParser::ConditionalExpressionContext* /*ctx*/) override {}
|
||||
void exitConditionalExpression(
|
||||
TorqueParser::ConditionalExpressionContext* /*ctx*/) override {}
|
||||
|
||||
void enterLogicalORExpression(
|
||||
TorqueParser::LogicalORExpressionContext* /*ctx*/) override {}
|
||||
void exitLogicalORExpression(
|
||||
TorqueParser::LogicalORExpressionContext* /*ctx*/) override {}
|
||||
|
||||
void enterLogicalANDExpression(
|
||||
TorqueParser::LogicalANDExpressionContext* /*ctx*/) override {}
|
||||
void exitLogicalANDExpression(
|
||||
TorqueParser::LogicalANDExpressionContext* /*ctx*/) override {}
|
||||
|
||||
void enterBitwiseExpression(
|
||||
TorqueParser::BitwiseExpressionContext* /*ctx*/) override {}
|
||||
void exitBitwiseExpression(
|
||||
TorqueParser::BitwiseExpressionContext* /*ctx*/) override {}
|
||||
|
||||
void enterEqualityExpression(
|
||||
TorqueParser::EqualityExpressionContext* /*ctx*/) override {}
|
||||
void exitEqualityExpression(
|
||||
TorqueParser::EqualityExpressionContext* /*ctx*/) override {}
|
||||
|
||||
void enterRelationalExpression(
|
||||
TorqueParser::RelationalExpressionContext* /*ctx*/) override {}
|
||||
void exitRelationalExpression(
|
||||
TorqueParser::RelationalExpressionContext* /*ctx*/) override {}
|
||||
|
||||
void enterShiftExpression(
|
||||
TorqueParser::ShiftExpressionContext* /*ctx*/) override {}
|
||||
void exitShiftExpression(
|
||||
TorqueParser::ShiftExpressionContext* /*ctx*/) override {}
|
||||
|
||||
void enterAdditiveExpression(
|
||||
TorqueParser::AdditiveExpressionContext* /*ctx*/) override {}
|
||||
void exitAdditiveExpression(
|
||||
TorqueParser::AdditiveExpressionContext* /*ctx*/) override {}
|
||||
|
||||
void enterMultiplicativeExpression(
|
||||
TorqueParser::MultiplicativeExpressionContext* /*ctx*/) override {}
|
||||
void exitMultiplicativeExpression(
|
||||
TorqueParser::MultiplicativeExpressionContext* /*ctx*/) override {}
|
||||
|
||||
void enterUnaryExpression(
|
||||
TorqueParser::UnaryExpressionContext* /*ctx*/) override {}
|
||||
void exitUnaryExpression(
|
||||
TorqueParser::UnaryExpressionContext* /*ctx*/) override {}
|
||||
|
||||
void enterLocationExpression(
|
||||
TorqueParser::LocationExpressionContext* /*ctx*/) override {}
|
||||
void exitLocationExpression(
|
||||
TorqueParser::LocationExpressionContext* /*ctx*/) override {}
|
||||
|
||||
void enterIncrementDecrement(
|
||||
TorqueParser::IncrementDecrementContext* /*ctx*/) override {}
|
||||
void exitIncrementDecrement(
|
||||
TorqueParser::IncrementDecrementContext* /*ctx*/) override {}
|
||||
|
||||
void enterAssignment(TorqueParser::AssignmentContext* /*ctx*/) override {}
|
||||
void exitAssignment(TorqueParser::AssignmentContext* /*ctx*/) override {}
|
||||
|
||||
void enterAssignmentExpression(
|
||||
TorqueParser::AssignmentExpressionContext* /*ctx*/) override {}
|
||||
void exitAssignmentExpression(
|
||||
TorqueParser::AssignmentExpressionContext* /*ctx*/) override {}
|
||||
|
||||
void enterStructExpression(
|
||||
TorqueParser::StructExpressionContext* /*ctx*/) override {}
|
||||
void exitStructExpression(
|
||||
TorqueParser::StructExpressionContext* /*ctx*/) override {}
|
||||
|
||||
void enterFunctionPointerExpression(
|
||||
TorqueParser::FunctionPointerExpressionContext* /*ctx*/) override {}
|
||||
void exitFunctionPointerExpression(
|
||||
TorqueParser::FunctionPointerExpressionContext* /*ctx*/) override {}
|
||||
|
||||
void enterPrimaryExpression(
|
||||
TorqueParser::PrimaryExpressionContext* /*ctx*/) override {}
|
||||
void exitPrimaryExpression(
|
||||
TorqueParser::PrimaryExpressionContext* /*ctx*/) override {}
|
||||
|
||||
void enterForInitialization(
|
||||
TorqueParser::ForInitializationContext* /*ctx*/) override {}
|
||||
void exitForInitialization(
|
||||
TorqueParser::ForInitializationContext* /*ctx*/) override {}
|
||||
|
||||
void enterForLoop(TorqueParser::ForLoopContext* /*ctx*/) override {}
|
||||
void exitForLoop(TorqueParser::ForLoopContext* /*ctx*/) override {}
|
||||
|
||||
void enterRangeSpecifier(
|
||||
TorqueParser::RangeSpecifierContext* /*ctx*/) override {}
|
||||
void exitRangeSpecifier(
|
||||
TorqueParser::RangeSpecifierContext* /*ctx*/) override {}
|
||||
|
||||
void enterForOfRange(TorqueParser::ForOfRangeContext* /*ctx*/) override {}
|
||||
void exitForOfRange(TorqueParser::ForOfRangeContext* /*ctx*/) override {}
|
||||
|
||||
void enterForOfLoop(TorqueParser::ForOfLoopContext* /*ctx*/) override {}
|
||||
void exitForOfLoop(TorqueParser::ForOfLoopContext* /*ctx*/) override {}
|
||||
|
||||
void enterArgument(TorqueParser::ArgumentContext* /*ctx*/) override {}
|
||||
void exitArgument(TorqueParser::ArgumentContext* /*ctx*/) override {}
|
||||
|
||||
void enterArgumentList(TorqueParser::ArgumentListContext* /*ctx*/) override {}
|
||||
void exitArgumentList(TorqueParser::ArgumentListContext* /*ctx*/) override {}
|
||||
|
||||
void enterHelperCall(TorqueParser::HelperCallContext* /*ctx*/) override {}
|
||||
void exitHelperCall(TorqueParser::HelperCallContext* /*ctx*/) override {}
|
||||
|
||||
void enterLabelReference(
|
||||
TorqueParser::LabelReferenceContext* /*ctx*/) override {}
|
||||
void exitLabelReference(
|
||||
TorqueParser::LabelReferenceContext* /*ctx*/) override {}
|
||||
|
||||
void enterVariableDeclaration(
|
||||
TorqueParser::VariableDeclarationContext* /*ctx*/) override {}
|
||||
void exitVariableDeclaration(
|
||||
TorqueParser::VariableDeclarationContext* /*ctx*/) override {}
|
||||
|
||||
void enterVariableDeclarationWithInitialization(
|
||||
TorqueParser::VariableDeclarationWithInitializationContext* /*ctx*/)
|
||||
override {}
|
||||
void exitVariableDeclarationWithInitialization(
|
||||
TorqueParser::VariableDeclarationWithInitializationContext* /*ctx*/)
|
||||
override {}
|
||||
|
||||
void enterHelperCallStatement(
|
||||
TorqueParser::HelperCallStatementContext* /*ctx*/) override {}
|
||||
void exitHelperCallStatement(
|
||||
TorqueParser::HelperCallStatementContext* /*ctx*/) override {}
|
||||
|
||||
void enterExpressionStatement(
|
||||
TorqueParser::ExpressionStatementContext* /*ctx*/) override {}
|
||||
void exitExpressionStatement(
|
||||
TorqueParser::ExpressionStatementContext* /*ctx*/) override {}
|
||||
|
||||
void enterIfStatement(TorqueParser::IfStatementContext* /*ctx*/) override {}
|
||||
void exitIfStatement(TorqueParser::IfStatementContext* /*ctx*/) override {}
|
||||
|
||||
void enterWhileLoop(TorqueParser::WhileLoopContext* /*ctx*/) override {}
|
||||
void exitWhileLoop(TorqueParser::WhileLoopContext* /*ctx*/) override {}
|
||||
|
||||
void enterReturnStatement(
|
||||
TorqueParser::ReturnStatementContext* /*ctx*/) override {}
|
||||
void exitReturnStatement(
|
||||
TorqueParser::ReturnStatementContext* /*ctx*/) override {}
|
||||
|
||||
void enterBreakStatement(
|
||||
TorqueParser::BreakStatementContext* /*ctx*/) override {}
|
||||
void exitBreakStatement(
|
||||
TorqueParser::BreakStatementContext* /*ctx*/) override {}
|
||||
|
||||
void enterContinueStatement(
|
||||
TorqueParser::ContinueStatementContext* /*ctx*/) override {}
|
||||
void exitContinueStatement(
|
||||
TorqueParser::ContinueStatementContext* /*ctx*/) override {}
|
||||
|
||||
void enterGotoStatement(
|
||||
TorqueParser::GotoStatementContext* /*ctx*/) override {}
|
||||
void exitGotoStatement(TorqueParser::GotoStatementContext* /*ctx*/) override {
|
||||
}
|
||||
|
||||
void enterHandlerWithStatement(
|
||||
TorqueParser::HandlerWithStatementContext* /*ctx*/) override {}
|
||||
void exitHandlerWithStatement(
|
||||
TorqueParser::HandlerWithStatementContext* /*ctx*/) override {}
|
||||
|
||||
void enterTryLabelStatement(
|
||||
TorqueParser::TryLabelStatementContext* /*ctx*/) override {}
|
||||
void exitTryLabelStatement(
|
||||
TorqueParser::TryLabelStatementContext* /*ctx*/) override {}
|
||||
|
||||
void enterDiagnosticStatement(
|
||||
TorqueParser::DiagnosticStatementContext* /*ctx*/) override {}
|
||||
void exitDiagnosticStatement(
|
||||
TorqueParser::DiagnosticStatementContext* /*ctx*/) override {}
|
||||
|
||||
void enterStatement(TorqueParser::StatementContext* /*ctx*/) override {}
|
||||
void exitStatement(TorqueParser::StatementContext* /*ctx*/) override {}
|
||||
|
||||
void enterStatementList(
|
||||
TorqueParser::StatementListContext* /*ctx*/) override {}
|
||||
void exitStatementList(TorqueParser::StatementListContext* /*ctx*/) override {
|
||||
}
|
||||
|
||||
void enterStatementScope(
|
||||
TorqueParser::StatementScopeContext* /*ctx*/) override {}
|
||||
void exitStatementScope(
|
||||
TorqueParser::StatementScopeContext* /*ctx*/) override {}
|
||||
|
||||
void enterStatementBlock(
|
||||
TorqueParser::StatementBlockContext* /*ctx*/) override {}
|
||||
void exitStatementBlock(
|
||||
TorqueParser::StatementBlockContext* /*ctx*/) override {}
|
||||
|
||||
void enterHelperBody(TorqueParser::HelperBodyContext* /*ctx*/) override {}
|
||||
void exitHelperBody(TorqueParser::HelperBodyContext* /*ctx*/) override {}
|
||||
|
||||
void enterFieldDeclaration(
|
||||
TorqueParser::FieldDeclarationContext* /*ctx*/) override {}
|
||||
void exitFieldDeclaration(
|
||||
TorqueParser::FieldDeclarationContext* /*ctx*/) override {}
|
||||
|
||||
void enterFieldListDeclaration(
|
||||
TorqueParser::FieldListDeclarationContext* /*ctx*/) override {}
|
||||
void exitFieldListDeclaration(
|
||||
TorqueParser::FieldListDeclarationContext* /*ctx*/) override {}
|
||||
|
||||
void enterExtendsDeclaration(
|
||||
TorqueParser::ExtendsDeclarationContext* /*ctx*/) override {}
|
||||
void exitExtendsDeclaration(
|
||||
TorqueParser::ExtendsDeclarationContext* /*ctx*/) override {}
|
||||
|
||||
void enterGeneratesDeclaration(
|
||||
TorqueParser::GeneratesDeclarationContext* /*ctx*/) override {}
|
||||
void exitGeneratesDeclaration(
|
||||
TorqueParser::GeneratesDeclarationContext* /*ctx*/) override {}
|
||||
|
||||
void enterConstexprDeclaration(
|
||||
TorqueParser::ConstexprDeclarationContext* /*ctx*/) override {}
|
||||
void exitConstexprDeclaration(
|
||||
TorqueParser::ConstexprDeclarationContext* /*ctx*/) override {}
|
||||
|
||||
void enterTypeDeclaration(
|
||||
TorqueParser::TypeDeclarationContext* /*ctx*/) override {}
|
||||
void exitTypeDeclaration(
|
||||
TorqueParser::TypeDeclarationContext* /*ctx*/) override {}
|
||||
|
||||
void enterTypeAliasDeclaration(
|
||||
TorqueParser::TypeAliasDeclarationContext* /*ctx*/) override {}
|
||||
void exitTypeAliasDeclaration(
|
||||
TorqueParser::TypeAliasDeclarationContext* /*ctx*/) override {}
|
||||
|
||||
void enterExternalBuiltin(
|
||||
TorqueParser::ExternalBuiltinContext* /*ctx*/) override {}
|
||||
void exitExternalBuiltin(
|
||||
TorqueParser::ExternalBuiltinContext* /*ctx*/) override {}
|
||||
|
||||
void enterExternalMacro(
|
||||
TorqueParser::ExternalMacroContext* /*ctx*/) override {}
|
||||
void exitExternalMacro(TorqueParser::ExternalMacroContext* /*ctx*/) override {
|
||||
}
|
||||
|
||||
void enterExternalRuntime(
|
||||
TorqueParser::ExternalRuntimeContext* /*ctx*/) override {}
|
||||
void exitExternalRuntime(
|
||||
TorqueParser::ExternalRuntimeContext* /*ctx*/) override {}
|
||||
|
||||
void enterBuiltinDeclaration(
|
||||
TorqueParser::BuiltinDeclarationContext* /*ctx*/) override {}
|
||||
void exitBuiltinDeclaration(
|
||||
TorqueParser::BuiltinDeclarationContext* /*ctx*/) override {}
|
||||
|
||||
void enterGenericSpecialization(
|
||||
TorqueParser::GenericSpecializationContext* /*ctx*/) override {}
|
||||
void exitGenericSpecialization(
|
||||
TorqueParser::GenericSpecializationContext* /*ctx*/) override {}
|
||||
|
||||
void enterMacroDeclaration(
|
||||
TorqueParser::MacroDeclarationContext* /*ctx*/) override {}
|
||||
void exitMacroDeclaration(
|
||||
TorqueParser::MacroDeclarationContext* /*ctx*/) override {}
|
||||
|
||||
void enterExternConstDeclaration(
|
||||
TorqueParser::ExternConstDeclarationContext* /*ctx*/) override {}
|
||||
void exitExternConstDeclaration(
|
||||
TorqueParser::ExternConstDeclarationContext* /*ctx*/) override {}
|
||||
|
||||
void enterConstDeclaration(
|
||||
TorqueParser::ConstDeclarationContext* /*ctx*/) override {}
|
||||
void exitConstDeclaration(
|
||||
TorqueParser::ConstDeclarationContext* /*ctx*/) override {}
|
||||
|
||||
void enterStructDeclaration(
|
||||
TorqueParser::StructDeclarationContext* /*ctx*/) override {}
|
||||
void exitStructDeclaration(
|
||||
TorqueParser::StructDeclarationContext* /*ctx*/) override {}
|
||||
|
||||
void enterDeclaration(TorqueParser::DeclarationContext* /*ctx*/) override {}
|
||||
void exitDeclaration(TorqueParser::DeclarationContext* /*ctx*/) override {}
|
||||
|
||||
void enterModuleDeclaration(
|
||||
TorqueParser::ModuleDeclarationContext* /*ctx*/) override {}
|
||||
void exitModuleDeclaration(
|
||||
TorqueParser::ModuleDeclarationContext* /*ctx*/) override {}
|
||||
|
||||
void enterFile(TorqueParser::FileContext* /*ctx*/) override {}
|
||||
void exitFile(TorqueParser::FileContext* /*ctx*/) override {}
|
||||
|
||||
void enterEveryRule(antlr4::ParserRuleContext* /*ctx*/) override {}
|
||||
void exitEveryRule(antlr4::ParserRuleContext* /*ctx*/) override {}
|
||||
void visitTerminal(antlr4::tree::TerminalNode* /*node*/) override {}
|
||||
void visitErrorNode(antlr4::tree::ErrorNode* /*node*/) override {}
|
||||
};
|
||||
|
||||
#endif // V8_TORQUE_TORQUEBASELISTENER_H_
|
@ -1,7 +0,0 @@
|
||||
// Copyright 2018 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Generated from Torque.g4 by ANTLR 4.7.1
|
||||
|
||||
#include "TorqueBaseVisitor.h"
|
@ -1,389 +0,0 @@
|
||||
// Copyright 2018 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
#ifndef V8_TORQUE_TORQUEBASEVISITOR_H_
|
||||
#define V8_TORQUE_TORQUEBASEVISITOR_H_
|
||||
|
||||
// Generated from Torque.g4 by ANTLR 4.7.1
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "./antlr4-runtime.h"
|
||||
#include "TorqueVisitor.h"
|
||||
|
||||
/**
|
||||
* This class provides an empty implementation of TorqueVisitor, which can be
|
||||
* extended to create a visitor which only needs to handle a subset of the
|
||||
* available methods.
|
||||
*/
|
||||
class TorqueBaseVisitor : public TorqueVisitor {
|
||||
public:
|
||||
antlrcpp::Any visitType(TorqueParser::TypeContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitTypeList(TorqueParser::TypeListContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitGenericSpecializationTypeList(
|
||||
TorqueParser::GenericSpecializationTypeListContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitOptionalGenericTypeList(
|
||||
TorqueParser::OptionalGenericTypeListContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitTypeListMaybeVarArgs(
|
||||
TorqueParser::TypeListMaybeVarArgsContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitLabelParameter(
|
||||
TorqueParser::LabelParameterContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitOptionalType(
|
||||
TorqueParser::OptionalTypeContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitOptionalLabelList(
|
||||
TorqueParser::OptionalLabelListContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitOptionalOtherwise(
|
||||
TorqueParser::OptionalOtherwiseContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitParameter(TorqueParser::ParameterContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitParameterList(
|
||||
TorqueParser::ParameterListContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitLabelDeclaration(
|
||||
TorqueParser::LabelDeclarationContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitExpression(TorqueParser::ExpressionContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitConditionalExpression(
|
||||
TorqueParser::ConditionalExpressionContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitLogicalORExpression(
|
||||
TorqueParser::LogicalORExpressionContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitLogicalANDExpression(
|
||||
TorqueParser::LogicalANDExpressionContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitBitwiseExpression(
|
||||
TorqueParser::BitwiseExpressionContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitEqualityExpression(
|
||||
TorqueParser::EqualityExpressionContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitRelationalExpression(
|
||||
TorqueParser::RelationalExpressionContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitShiftExpression(
|
||||
TorqueParser::ShiftExpressionContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitAdditiveExpression(
|
||||
TorqueParser::AdditiveExpressionContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitMultiplicativeExpression(
|
||||
TorqueParser::MultiplicativeExpressionContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitUnaryExpression(
|
||||
TorqueParser::UnaryExpressionContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitLocationExpression(
|
||||
TorqueParser::LocationExpressionContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitIncrementDecrement(
|
||||
TorqueParser::IncrementDecrementContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitAssignment(TorqueParser::AssignmentContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitAssignmentExpression(
|
||||
TorqueParser::AssignmentExpressionContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitStructExpression(
|
||||
TorqueParser::StructExpressionContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitFunctionPointerExpression(
|
||||
TorqueParser::FunctionPointerExpressionContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitPrimaryExpression(
|
||||
TorqueParser::PrimaryExpressionContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitForInitialization(
|
||||
TorqueParser::ForInitializationContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitForLoop(TorqueParser::ForLoopContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitRangeSpecifier(
|
||||
TorqueParser::RangeSpecifierContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitForOfRange(TorqueParser::ForOfRangeContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitForOfLoop(TorqueParser::ForOfLoopContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitArgument(TorqueParser::ArgumentContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitArgumentList(
|
||||
TorqueParser::ArgumentListContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitHelperCall(TorqueParser::HelperCallContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitLabelReference(
|
||||
TorqueParser::LabelReferenceContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitVariableDeclaration(
|
||||
TorqueParser::VariableDeclarationContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitVariableDeclarationWithInitialization(
|
||||
TorqueParser::VariableDeclarationWithInitializationContext* ctx)
|
||||
override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitHelperCallStatement(
|
||||
TorqueParser::HelperCallStatementContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitExpressionStatement(
|
||||
TorqueParser::ExpressionStatementContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitIfStatement(
|
||||
TorqueParser::IfStatementContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitWhileLoop(TorqueParser::WhileLoopContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitReturnStatement(
|
||||
TorqueParser::ReturnStatementContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitBreakStatement(
|
||||
TorqueParser::BreakStatementContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitContinueStatement(
|
||||
TorqueParser::ContinueStatementContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitGotoStatement(
|
||||
TorqueParser::GotoStatementContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitHandlerWithStatement(
|
||||
TorqueParser::HandlerWithStatementContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitTryLabelStatement(
|
||||
TorqueParser::TryLabelStatementContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitDiagnosticStatement(
|
||||
TorqueParser::DiagnosticStatementContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitStatement(TorqueParser::StatementContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitStatementList(
|
||||
TorqueParser::StatementListContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitStatementScope(
|
||||
TorqueParser::StatementScopeContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitStatementBlock(
|
||||
TorqueParser::StatementBlockContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitHelperBody(TorqueParser::HelperBodyContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitFieldDeclaration(
|
||||
TorqueParser::FieldDeclarationContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitFieldListDeclaration(
|
||||
TorqueParser::FieldListDeclarationContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitExtendsDeclaration(
|
||||
TorqueParser::ExtendsDeclarationContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitGeneratesDeclaration(
|
||||
TorqueParser::GeneratesDeclarationContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitConstexprDeclaration(
|
||||
TorqueParser::ConstexprDeclarationContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitTypeDeclaration(
|
||||
TorqueParser::TypeDeclarationContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitTypeAliasDeclaration(
|
||||
TorqueParser::TypeAliasDeclarationContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitExternalBuiltin(
|
||||
TorqueParser::ExternalBuiltinContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitExternalMacro(
|
||||
TorqueParser::ExternalMacroContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitExternalRuntime(
|
||||
TorqueParser::ExternalRuntimeContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitBuiltinDeclaration(
|
||||
TorqueParser::BuiltinDeclarationContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitGenericSpecialization(
|
||||
TorqueParser::GenericSpecializationContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitMacroDeclaration(
|
||||
TorqueParser::MacroDeclarationContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitExternConstDeclaration(
|
||||
TorqueParser::ExternConstDeclarationContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitConstDeclaration(
|
||||
TorqueParser::ConstDeclarationContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitStructDeclaration(
|
||||
TorqueParser::StructDeclarationContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitDeclaration(
|
||||
TorqueParser::DeclarationContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitModuleDeclaration(
|
||||
TorqueParser::ModuleDeclarationContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
|
||||
antlrcpp::Any visitFile(TorqueParser::FileContext* ctx) override {
|
||||
return visitChildren(ctx);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // V8_TORQUE_TORQUEBASEVISITOR_H_
|
@ -1,988 +0,0 @@
|
||||
// Copyright 2018 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Generated from Torque.g4 by ANTLR 4.7.1
|
||||
|
||||
#include "TorqueLexer.h"
|
||||
|
||||
using namespace antlr4;
|
||||
|
||||
TorqueLexer::TorqueLexer(CharStream* input) : Lexer(input) {
|
||||
_interpreter = new atn::LexerATNSimulator(this, _atn, _decisionToDFA,
|
||||
_sharedContextCache);
|
||||
}
|
||||
|
||||
TorqueLexer::~TorqueLexer() { delete _interpreter; }
|
||||
|
||||
std::string TorqueLexer::getGrammarFileName() const { return "Torque.g4"; }
|
||||
|
||||
const std::vector<std::string>& TorqueLexer::getRuleNames() const {
|
||||
return _ruleNames;
|
||||
}
|
||||
|
||||
const std::vector<std::string>& TorqueLexer::getChannelNames() const {
|
||||
return _channelNames;
|
||||
}
|
||||
|
||||
const std::vector<std::string>& TorqueLexer::getModeNames() const {
|
||||
return _modeNames;
|
||||
}
|
||||
|
||||
const std::vector<std::string>& TorqueLexer::getTokenNames() const {
|
||||
return _tokenNames;
|
||||
}
|
||||
|
||||
dfa::Vocabulary& TorqueLexer::getVocabulary() const { return _vocabulary; }
|
||||
|
||||
const std::vector<uint16_t> TorqueLexer::getSerializedATN() const {
|
||||
return _serializedATN;
|
||||
}
|
||||
|
||||
const atn::ATN& TorqueLexer::getATN() const { return _atn; }
|
||||
|
||||
// Static vars and initialization.
|
||||
std::vector<dfa::DFA> TorqueLexer::_decisionToDFA;
|
||||
atn::PredictionContextCache TorqueLexer::_sharedContextCache;
|
||||
|
||||
// We own the ATN which in turn owns the ATN states.
|
||||
atn::ATN TorqueLexer::_atn;
|
||||
std::vector<uint16_t> TorqueLexer::_serializedATN;
|
||||
|
||||
std::vector<std::string> TorqueLexer::_ruleNames = {u8"T__0",
|
||||
u8"T__1",
|
||||
u8"T__2",
|
||||
u8"T__3",
|
||||
u8"T__4",
|
||||
u8"T__5",
|
||||
u8"T__6",
|
||||
u8"T__7",
|
||||
u8"T__8",
|
||||
u8"T__9",
|
||||
u8"T__10",
|
||||
u8"T__11",
|
||||
u8"T__12",
|
||||
u8"T__13",
|
||||
u8"T__14",
|
||||
u8"T__15",
|
||||
u8"T__16",
|
||||
u8"T__17",
|
||||
u8"T__18",
|
||||
u8"T__19",
|
||||
u8"T__20",
|
||||
u8"MACRO",
|
||||
u8"BUILTIN",
|
||||
u8"RUNTIME",
|
||||
u8"MODULE",
|
||||
u8"JAVASCRIPT",
|
||||
u8"DEFERRED",
|
||||
u8"IF",
|
||||
u8"FOR",
|
||||
u8"WHILE",
|
||||
u8"RETURN",
|
||||
u8"CONSTEXPR",
|
||||
u8"CONTINUE",
|
||||
u8"BREAK",
|
||||
u8"GOTO",
|
||||
u8"OTHERWISE",
|
||||
u8"TRY",
|
||||
u8"LABEL",
|
||||
u8"LABELS",
|
||||
u8"TAIL",
|
||||
u8"ISNT",
|
||||
u8"IS",
|
||||
u8"LET",
|
||||
u8"CONST",
|
||||
u8"EXTERN",
|
||||
u8"ASSERT_TOKEN",
|
||||
u8"CHECK_TOKEN",
|
||||
u8"UNREACHABLE_TOKEN",
|
||||
u8"DEBUG_TOKEN",
|
||||
u8"ASSIGNMENT",
|
||||
u8"ASSIGNMENT_OPERATOR",
|
||||
u8"EQUAL",
|
||||
u8"PLUS",
|
||||
u8"MINUS",
|
||||
u8"MULTIPLY",
|
||||
u8"DIVIDE",
|
||||
u8"MODULO",
|
||||
u8"BIT_OR",
|
||||
u8"BIT_AND",
|
||||
u8"BIT_NOT",
|
||||
u8"MAX",
|
||||
u8"MIN",
|
||||
u8"NOT_EQUAL",
|
||||
u8"LESS_THAN",
|
||||
u8"LESS_THAN_EQUAL",
|
||||
u8"GREATER_THAN",
|
||||
u8"GREATER_THAN_EQUAL",
|
||||
u8"SHIFT_LEFT",
|
||||
u8"SHIFT_RIGHT",
|
||||
u8"SHIFT_RIGHT_ARITHMETIC",
|
||||
u8"VARARGS",
|
||||
u8"EQUALITY_OPERATOR",
|
||||
u8"INCREMENT",
|
||||
u8"DECREMENT",
|
||||
u8"NOT",
|
||||
u8"STRING_LITERAL",
|
||||
u8"ESCAPE",
|
||||
u8"IDENTIFIER",
|
||||
u8"WS",
|
||||
u8"BLOCK_COMMENT",
|
||||
u8"LINE_COMMENT",
|
||||
u8"DECIMAL_DIGIT",
|
||||
u8"DECIMAL_INTEGER_LITERAL",
|
||||
u8"EXPONENT_PART",
|
||||
u8"DECIMAL_LITERAL"};
|
||||
|
||||
std::vector<std::string> TorqueLexer::_channelNames = {"DEFAULT_TOKEN_CHANNEL",
|
||||
"HIDDEN"};
|
||||
|
||||
std::vector<std::string> TorqueLexer::_modeNames = {u8"DEFAULT_MODE"};
|
||||
|
||||
std::vector<std::string> TorqueLexer::_literalNames = {"",
|
||||
u8"'('",
|
||||
u8"')'",
|
||||
u8"'=>'",
|
||||
u8"','",
|
||||
u8"':'",
|
||||
u8"'type'",
|
||||
u8"'?'",
|
||||
u8"'||'",
|
||||
u8"'&&'",
|
||||
u8"'.'",
|
||||
u8"'['",
|
||||
u8"']'",
|
||||
u8"'{'",
|
||||
u8"'}'",
|
||||
u8"';'",
|
||||
u8"'of'",
|
||||
u8"'else'",
|
||||
u8"'extends'",
|
||||
u8"'generates'",
|
||||
u8"'operator'",
|
||||
u8"'struct'",
|
||||
u8"'macro'",
|
||||
u8"'builtin'",
|
||||
u8"'runtime'",
|
||||
u8"'module'",
|
||||
u8"'javascript'",
|
||||
u8"'deferred'",
|
||||
u8"'if'",
|
||||
u8"'for'",
|
||||
u8"'while'",
|
||||
u8"'return'",
|
||||
u8"'constexpr'",
|
||||
u8"'continue'",
|
||||
u8"'break'",
|
||||
u8"'goto'",
|
||||
u8"'otherwise'",
|
||||
u8"'try'",
|
||||
u8"'label'",
|
||||
u8"'labels'",
|
||||
u8"'tail'",
|
||||
u8"'isnt'",
|
||||
u8"'is'",
|
||||
u8"'let'",
|
||||
u8"'const'",
|
||||
u8"'extern'",
|
||||
u8"'assert'",
|
||||
u8"'check'",
|
||||
u8"'unreachable'",
|
||||
u8"'debug'",
|
||||
u8"'='",
|
||||
"",
|
||||
u8"'=='",
|
||||
u8"'+'",
|
||||
u8"'-'",
|
||||
u8"'*'",
|
||||
u8"'/'",
|
||||
u8"'%'",
|
||||
u8"'|'",
|
||||
u8"'&'",
|
||||
u8"'~'",
|
||||
u8"'max'",
|
||||
u8"'min'",
|
||||
u8"'!='",
|
||||
u8"'<'",
|
||||
u8"'<='",
|
||||
u8"'>'",
|
||||
u8"'>='",
|
||||
u8"'<<'",
|
||||
u8"'>>'",
|
||||
u8"'>>>'",
|
||||
u8"'...'",
|
||||
"",
|
||||
u8"'++'",
|
||||
u8"'--'",
|
||||
u8"'!'"};
|
||||
|
||||
std::vector<std::string> TorqueLexer::_symbolicNames = {
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
"",
|
||||
u8"MACRO",
|
||||
u8"BUILTIN",
|
||||
u8"RUNTIME",
|
||||
u8"MODULE",
|
||||
u8"JAVASCRIPT",
|
||||
u8"DEFERRED",
|
||||
u8"IF",
|
||||
u8"FOR",
|
||||
u8"WHILE",
|
||||
u8"RETURN",
|
||||
u8"CONSTEXPR",
|
||||
u8"CONTINUE",
|
||||
u8"BREAK",
|
||||
u8"GOTO",
|
||||
u8"OTHERWISE",
|
||||
u8"TRY",
|
||||
u8"LABEL",
|
||||
u8"LABELS",
|
||||
u8"TAIL",
|
||||
u8"ISNT",
|
||||
u8"IS",
|
||||
u8"LET",
|
||||
u8"CONST",
|
||||
u8"EXTERN",
|
||||
u8"ASSERT_TOKEN",
|
||||
u8"CHECK_TOKEN",
|
||||
u8"UNREACHABLE_TOKEN",
|
||||
u8"DEBUG_TOKEN",
|
||||
u8"ASSIGNMENT",
|
||||
u8"ASSIGNMENT_OPERATOR",
|
||||
u8"EQUAL",
|
||||
u8"PLUS",
|
||||
u8"MINUS",
|
||||
u8"MULTIPLY",
|
||||
u8"DIVIDE",
|
||||
u8"MODULO",
|
||||
u8"BIT_OR",
|
||||
u8"BIT_AND",
|
||||
u8"BIT_NOT",
|
||||
u8"MAX",
|
||||
u8"MIN",
|
||||
u8"NOT_EQUAL",
|
||||
u8"LESS_THAN",
|
||||
u8"LESS_THAN_EQUAL",
|
||||
u8"GREATER_THAN",
|
||||
u8"GREATER_THAN_EQUAL",
|
||||
u8"SHIFT_LEFT",
|
||||
u8"SHIFT_RIGHT",
|
||||
u8"SHIFT_RIGHT_ARITHMETIC",
|
||||
u8"VARARGS",
|
||||
u8"EQUALITY_OPERATOR",
|
||||
u8"INCREMENT",
|
||||
u8"DECREMENT",
|
||||
u8"NOT",
|
||||
u8"STRING_LITERAL",
|
||||
u8"IDENTIFIER",
|
||||
u8"WS",
|
||||
u8"BLOCK_COMMENT",
|
||||
u8"LINE_COMMENT",
|
||||
u8"DECIMAL_LITERAL"};
|
||||
|
||||
dfa::Vocabulary TorqueLexer::_vocabulary(_literalNames, _symbolicNames);
|
||||
|
||||
std::vector<std::string> TorqueLexer::_tokenNames;
|
||||
|
||||
TorqueLexer::Initializer::Initializer() {
|
||||
// This code could be in a static initializer lambda, but VS doesn't allow
|
||||
// access to private class members from there.
|
||||
for (size_t i = 0; i < _symbolicNames.size(); ++i) {
|
||||
std::string name = _vocabulary.getLiteralName(i);
|
||||
if (name.empty()) {
|
||||
name = _vocabulary.getSymbolicName(i);
|
||||
}
|
||||
|
||||
if (name.empty()) {
|
||||
_tokenNames.push_back("<INVALID>");
|
||||
} else {
|
||||
_tokenNames.push_back(name);
|
||||
}
|
||||
}
|
||||
|
||||
_serializedATN = {
|
||||
0x3, 0x608b, 0xa72a, 0x8133, 0xb9ed, 0x417c, 0x3be7, 0x7786, 0x5964,
|
||||
0x2, 0x53, 0x299, 0x8, 0x1, 0x4, 0x2, 0x9, 0x2,
|
||||
0x4, 0x3, 0x9, 0x3, 0x4, 0x4, 0x9, 0x4, 0x4,
|
||||
0x5, 0x9, 0x5, 0x4, 0x6, 0x9, 0x6, 0x4, 0x7,
|
||||
0x9, 0x7, 0x4, 0x8, 0x9, 0x8, 0x4, 0x9, 0x9,
|
||||
0x9, 0x4, 0xa, 0x9, 0xa, 0x4, 0xb, 0x9, 0xb,
|
||||
0x4, 0xc, 0x9, 0xc, 0x4, 0xd, 0x9, 0xd, 0x4,
|
||||
0xe, 0x9, 0xe, 0x4, 0xf, 0x9, 0xf, 0x4, 0x10,
|
||||
0x9, 0x10, 0x4, 0x11, 0x9, 0x11, 0x4, 0x12, 0x9,
|
||||
0x12, 0x4, 0x13, 0x9, 0x13, 0x4, 0x14, 0x9, 0x14,
|
||||
0x4, 0x15, 0x9, 0x15, 0x4, 0x16, 0x9, 0x16, 0x4,
|
||||
0x17, 0x9, 0x17, 0x4, 0x18, 0x9, 0x18, 0x4, 0x19,
|
||||
0x9, 0x19, 0x4, 0x1a, 0x9, 0x1a, 0x4, 0x1b, 0x9,
|
||||
0x1b, 0x4, 0x1c, 0x9, 0x1c, 0x4, 0x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 0x3, 0x30, 0x3, 0x30, 0x3, 0x30,
|
||||
0x3, 0x30, 0x3, 0x31, 0x3, 0x31, 0x3, 0x31, 0x3,
|
||||
0x31, 0x3, 0x31, 0x3, 0x31, 0x3, 0x31, 0x3, 0x31,
|
||||
0x3, 0x31, 0x3, 0x31, 0x3, 0x31, 0x3, 0x31, 0x3,
|
||||
0x32, 0x3, 0x32, 0x3, 0x32, 0x3, 0x32, 0x3, 0x32,
|
||||
0x3, 0x32, 0x3, 0x33, 0x3, 0x33, 0x3, 0x34, 0x3,
|
||||
0x34, 0x3, 0x34, 0x3, 0x34, 0x3, 0x34, 0x3, 0x34,
|
||||
0x3, 0x34, 0x3, 0x34, 0x3, 0x34, 0x3, 0x34, 0x3,
|
||||
0x34, 0x3, 0x34, 0x3, 0x34, 0x3, 0x34, 0x3, 0x34,
|
||||
0x3, 0x34, 0x3, 0x34, 0x3, 0x34, 0x3, 0x34, 0x3,
|
||||
0x34, 0x3, 0x34, 0x3, 0x34, 0x3, 0x34, 0x3, 0x34,
|
||||
0x3, 0x34, 0x3, 0x34, 0x5, 0x34, 0x1d3, 0xa, 0x34,
|
||||
0x3, 0x35, 0x3, 0x35, 0x3, 0x35, 0x3, 0x36, 0x3,
|
||||
0x36, 0x3, 0x37, 0x3, 0x37, 0x3, 0x38, 0x3, 0x38,
|
||||
0x3, 0x39, 0x3, 0x39, 0x3, 0x3a, 0x3, 0x3a, 0x3,
|
||||
0x3b, 0x3, 0x3b, 0x3, 0x3c, 0x3, 0x3c, 0x3, 0x3d,
|
||||
0x3, 0x3d, 0x3, 0x3e, 0x3, 0x3e, 0x3, 0x3e, 0x3,
|
||||
0x3e, 0x3, 0x3f, 0x3, 0x3f, 0x3, 0x3f, 0x3, 0x3f,
|
||||
0x3, 0x40, 0x3, 0x40, 0x3, 0x40, 0x3, 0x41, 0x3,
|
||||
0x41, 0x3, 0x42, 0x3, 0x42, 0x3, 0x42, 0x3, 0x43,
|
||||
0x3, 0x43, 0x3, 0x44, 0x3, 0x44, 0x3, 0x44, 0x3,
|
||||
0x45, 0x3, 0x45, 0x3, 0x45, 0x3, 0x46, 0x3, 0x46,
|
||||
0x3, 0x46, 0x3, 0x47, 0x3, 0x47, 0x3, 0x47, 0x3,
|
||||
0x47, 0x3, 0x48, 0x3, 0x48, 0x3, 0x48, 0x3, 0x48,
|
||||
0x3, 0x49, 0x3, 0x49, 0x5, 0x49, 0x20d, 0xa, 0x49,
|
||||
0x3, 0x4a, 0x3, 0x4a, 0x3, 0x4a, 0x3, 0x4b, 0x3,
|
||||
0x4b, 0x3, 0x4b, 0x3, 0x4c, 0x3, 0x4c, 0x3, 0x4d,
|
||||
0x3, 0x4d, 0x3, 0x4d, 0x7, 0x4d, 0x21a, 0xa, 0x4d,
|
||||
0xc, 0x4d, 0xe, 0x4d, 0x21d, 0xb, 0x4d, 0x3, 0x4d,
|
||||
0x3, 0x4d, 0x3, 0x4d, 0x3, 0x4d, 0x7, 0x4d, 0x223,
|
||||
0xa, 0x4d, 0xc, 0x4d, 0xe, 0x4d, 0x226, 0xb, 0x4d,
|
||||
0x3, 0x4d, 0x5, 0x4d, 0x229, 0xa, 0x4d, 0x3, 0x4e,
|
||||
0x3, 0x4e, 0x3, 0x4e, 0x3, 0x4f, 0x3, 0x4f, 0x7,
|
||||
0x4f, 0x230, 0xa, 0x4f, 0xc, 0x4f, 0xe, 0x4f, 0x233,
|
||||
0xb, 0x4f, 0x3, 0x50, 0x6, 0x50, 0x236, 0xa, 0x50,
|
||||
0xd, 0x50, 0xe, 0x50, 0x237, 0x3, 0x50, 0x3, 0x50,
|
||||
0x3, 0x51, 0x3, 0x51, 0x3, 0x51, 0x3, 0x51, 0x7,
|
||||
0x51, 0x240, 0xa, 0x51, 0xc, 0x51, 0xe, 0x51, 0x243,
|
||||
0xb, 0x51, 0x3, 0x51, 0x3, 0x51, 0x3, 0x51, 0x5,
|
||||
0x51, 0x248, 0xa, 0x51, 0x3, 0x51, 0x3, 0x51, 0x3,
|
||||
0x52, 0x3, 0x52, 0x3, 0x52, 0x3, 0x52, 0x7, 0x52,
|
||||
0x250, 0xa, 0x52, 0xc, 0x52, 0xe, 0x52, 0x253, 0xb,
|
||||
0x52, 0x3, 0x52, 0x3, 0x52, 0x3, 0x53, 0x3, 0x53,
|
||||
0x3, 0x54, 0x3, 0x54, 0x3, 0x54, 0x7, 0x54, 0x25c,
|
||||
0xa, 0x54, 0xc, 0x54, 0xe, 0x54, 0x25f, 0xb, 0x54,
|
||||
0x5, 0x54, 0x261, 0xa, 0x54, 0x3, 0x55, 0x3, 0x55,
|
||||
0x5, 0x55, 0x265, 0xa, 0x55, 0x3, 0x55, 0x6, 0x55,
|
||||
0x268, 0xa, 0x55, 0xd, 0x55, 0xe, 0x55, 0x269, 0x3,
|
||||
0x56, 0x5, 0x56, 0x26d, 0xa, 0x56, 0x3, 0x56, 0x3,
|
||||
0x56, 0x3, 0x56, 0x7, 0x56, 0x272, 0xa, 0x56, 0xc,
|
||||
0x56, 0xe, 0x56, 0x275, 0xb, 0x56, 0x3, 0x56, 0x5,
|
||||
0x56, 0x278, 0xa, 0x56, 0x3, 0x56, 0x5, 0x56, 0x27b,
|
||||
0xa, 0x56, 0x3, 0x56, 0x3, 0x56, 0x6, 0x56, 0x27f,
|
||||
0xa, 0x56, 0xd, 0x56, 0xe, 0x56, 0x280, 0x3, 0x56,
|
||||
0x5, 0x56, 0x284, 0xa, 0x56, 0x3, 0x56, 0x5, 0x56,
|
||||
0x287, 0xa, 0x56, 0x3, 0x56, 0x3, 0x56, 0x5, 0x56,
|
||||
0x28b, 0xa, 0x56, 0x3, 0x56, 0x5, 0x56, 0x28e, 0xa,
|
||||
0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56, 0x3, 0x56,
|
||||
0x6, 0x56, 0x294, 0xa, 0x56, 0xd, 0x56, 0xe, 0x56,
|
||||
0x295, 0x5, 0x56, 0x298, 0xa, 0x56, 0x3, 0x241, 0x2,
|
||||
0x57, 0x3, 0x3, 0x5, 0x4, 0x7, 0x5, 0x9, 0x6,
|
||||
0xb, 0x7, 0xd, 0x8, 0xf, 0x9, 0x11, 0xa, 0x13,
|
||||
0xb, 0x15, 0xc, 0x17, 0xd, 0x19, 0xe, 0x1b, 0xf,
|
||||
0x1d, 0x10, 0x1f, 0x11, 0x21, 0x12, 0x23, 0x13, 0x25,
|
||||
0x14, 0x27, 0x15, 0x29, 0x16, 0x2b, 0x17, 0x2d, 0x18,
|
||||
0x2f, 0x19, 0x31, 0x1a, 0x33, 0x1b, 0x35, 0x1c, 0x37,
|
||||
0x1d, 0x39, 0x1e, 0x3b, 0x1f, 0x3d, 0x20, 0x3f, 0x21,
|
||||
0x41, 0x22, 0x43, 0x23, 0x45, 0x24, 0x47, 0x25, 0x49,
|
||||
0x26, 0x4b, 0x27, 0x4d, 0x28, 0x4f, 0x29, 0x51, 0x2a,
|
||||
0x53, 0x2b, 0x55, 0x2c, 0x57, 0x2d, 0x59, 0x2e, 0x5b,
|
||||
0x2f, 0x5d, 0x30, 0x5f, 0x31, 0x61, 0x32, 0x63, 0x33,
|
||||
0x65, 0x34, 0x67, 0x35, 0x69, 0x36, 0x6b, 0x37, 0x6d,
|
||||
0x38, 0x6f, 0x39, 0x71, 0x3a, 0x73, 0x3b, 0x75, 0x3c,
|
||||
0x77, 0x3d, 0x79, 0x3e, 0x7b, 0x3f, 0x7d, 0x40, 0x7f,
|
||||
0x41, 0x81, 0x42, 0x83, 0x43, 0x85, 0x44, 0x87, 0x45,
|
||||
0x89, 0x46, 0x8b, 0x47, 0x8d, 0x48, 0x8f, 0x49, 0x91,
|
||||
0x4a, 0x93, 0x4b, 0x95, 0x4c, 0x97, 0x4d, 0x99, 0x4e,
|
||||
0x9b, 0x2, 0x9d, 0x4f, 0x9f, 0x50, 0xa1, 0x51, 0xa3,
|
||||
0x52, 0xa5, 0x2, 0xa7, 0x2, 0xa9, 0x2, 0xab, 0x53,
|
||||
0x3, 0x2, 0xe, 0x6, 0x2, 0xc, 0xc, 0xf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0x2, 0x104, 0x105, 0x7, 0x6e, 0x2, 0x2, 0x105,
|
||||
0x106, 0x7, 0x76, 0x2, 0x2, 0x106, 0x107, 0x7, 0x6b,
|
||||
0x2, 0x2, 0x107, 0x108, 0x7, 0x70, 0x2, 0x2, 0x108,
|
||||
0x30, 0x3, 0x2, 0x2, 0x2, 0x109, 0x10a, 0x7, 0x74,
|
||||
0x2, 0x2, 0x10a, 0x10b, 0x7, 0x77, 0x2, 0x2, 0x10b,
|
||||
0x10c, 0x7, 0x70, 0x2, 0x2, 0x10c, 0x10d, 0x7, 0x76,
|
||||
0x2, 0x2, 0x10d, 0x10e, 0x7, 0x6b, 0x2, 0x2, 0x10e,
|
||||
0x10f, 0x7, 0x6f, 0x2, 0x2, 0x10f, 0x110, 0x7, 0x67,
|
||||
0x2, 0x2, 0x110, 0x32, 0x3, 0x2, 0x2, 0x2, 0x111,
|
||||
0x112, 0x7, 0x6f, 0x2, 0x2, 0x112, 0x113, 0x7, 0x71,
|
||||
0x2, 0x2, 0x113, 0x114, 0x7, 0x66, 0x2, 0x2, 0x114,
|
||||
0x115, 0x7, 0x77, 0x2, 0x2, 0x115, 0x116, 0x7, 0x6e,
|
||||
0x2, 0x2, 0x116, 0x117, 0x7, 0x67, 0x2, 0x2, 0x117,
|
||||
0x34, 0x3, 0x2, 0x2, 0x2, 0x118, 0x119, 0x7, 0x6c,
|
||||
0x2, 0x2, 0x119, 0x11a, 0x7, 0x63, 0x2, 0x2, 0x11a,
|
||||
0x11b, 0x7, 0x78, 0x2, 0x2, 0x11b, 0x11c, 0x7, 0x63,
|
||||
0x2, 0x2, 0x11c, 0x11d, 0x7, 0x75, 0x2, 0x2, 0x11d,
|
||||
0x11e, 0x7, 0x65, 0x2, 0x2, 0x11e, 0x11f, 0x7, 0x74,
|
||||
0x2, 0x2, 0x11f, 0x120, 0x7, 0x6b, 0x2, 0x2, 0x120,
|
||||
0x121, 0x7, 0x72, 0x2, 0x2, 0x121, 0x122, 0x7, 0x76,
|
||||
0x2, 0x2, 0x122, 0x36, 0x3, 0x2, 0x2, 0x2, 0x123,
|
||||
0x124, 0x7, 0x66, 0x2, 0x2, 0x124, 0x125, 0x7, 0x67,
|
||||
0x2, 0x2, 0x125, 0x126, 0x7, 0x68, 0x2, 0x2, 0x126,
|
||||
0x127, 0x7, 0x67, 0x2, 0x2, 0x127, 0x128, 0x7, 0x74,
|
||||
0x2, 0x2, 0x128, 0x129, 0x7, 0x74, 0x2, 0x2, 0x129,
|
||||
0x12a, 0x7, 0x67, 0x2, 0x2, 0x12a, 0x12b, 0x7, 0x66,
|
||||
0x2, 0x2, 0x12b, 0x38, 0x3, 0x2, 0x2, 0x2, 0x12c,
|
||||
0x12d, 0x7, 0x6b, 0x2, 0x2, 0x12d, 0x12e, 0x7, 0x68,
|
||||
0x2, 0x2, 0x12e, 0x3a, 0x3, 0x2, 0x2, 0x2, 0x12f,
|
||||
0x130, 0x7, 0x68, 0x2, 0x2, 0x130, 0x131, 0x7, 0x71,
|
||||
0x2, 0x2, 0x131, 0x132, 0x7, 0x74, 0x2, 0x2, 0x132,
|
||||
0x3c, 0x3, 0x2, 0x2, 0x2, 0x133, 0x134, 0x7, 0x79,
|
||||
0x2, 0x2, 0x134, 0x135, 0x7, 0x6a, 0x2, 0x2, 0x135,
|
||||
0x136, 0x7, 0x6b, 0x2, 0x2, 0x136, 0x137, 0x7, 0x6e,
|
||||
0x2, 0x2, 0x137, 0x138, 0x7, 0x67, 0x2, 0x2, 0x138,
|
||||
0x3e, 0x3, 0x2, 0x2, 0x2, 0x139, 0x13a, 0x7, 0x74,
|
||||
0x2, 0x2, 0x13a, 0x13b, 0x7, 0x67, 0x2, 0x2, 0x13b,
|
||||
0x13c, 0x7, 0x76, 0x2, 0x2, 0x13c, 0x13d, 0x7, 0x77,
|
||||
0x2, 0x2, 0x13d, 0x13e, 0x7, 0x74, 0x2, 0x2, 0x13e,
|
||||
0x13f, 0x7, 0x70, 0x2, 0x2, 0x13f, 0x40, 0x3, 0x2,
|
||||
0x2, 0x2, 0x140, 0x141, 0x7, 0x65, 0x2, 0x2, 0x141,
|
||||
0x142, 0x7, 0x71, 0x2, 0x2, 0x142, 0x143, 0x7, 0x70,
|
||||
0x2, 0x2, 0x143, 0x144, 0x7, 0x75, 0x2, 0x2, 0x144,
|
||||
0x145, 0x7, 0x76, 0x2, 0x2, 0x145, 0x146, 0x7, 0x67,
|
||||
0x2, 0x2, 0x146, 0x147, 0x7, 0x7a, 0x2, 0x2, 0x147,
|
||||
0x148, 0x7, 0x72, 0x2, 0x2, 0x148, 0x149, 0x7, 0x74,
|
||||
0x2, 0x2, 0x149, 0x42, 0x3, 0x2, 0x2, 0x2, 0x14a,
|
||||
0x14b, 0x7, 0x65, 0x2, 0x2, 0x14b, 0x14c, 0x7, 0x71,
|
||||
0x2, 0x2, 0x14c, 0x14d, 0x7, 0x70, 0x2, 0x2, 0x14d,
|
||||
0x14e, 0x7, 0x76, 0x2, 0x2, 0x14e, 0x14f, 0x7, 0x6b,
|
||||
0x2, 0x2, 0x14f, 0x150, 0x7, 0x70, 0x2, 0x2, 0x150,
|
||||
0x151, 0x7, 0x77, 0x2, 0x2, 0x151, 0x152, 0x7, 0x67,
|
||||
0x2, 0x2, 0x152, 0x44, 0x3, 0x2, 0x2, 0x2, 0x153,
|
||||
0x154, 0x7, 0x64, 0x2, 0x2, 0x154, 0x155, 0x7, 0x74,
|
||||
0x2, 0x2, 0x155, 0x156, 0x7, 0x67, 0x2, 0x2, 0x156,
|
||||
0x157, 0x7, 0x63, 0x2, 0x2, 0x157, 0x158, 0x7, 0x6d,
|
||||
0x2, 0x2, 0x158, 0x46, 0x3, 0x2, 0x2, 0x2, 0x159,
|
||||
0x15a, 0x7, 0x69, 0x2, 0x2, 0x15a, 0x15b, 0x7, 0x71,
|
||||
0x2, 0x2, 0x15b, 0x15c, 0x7, 0x76, 0x2, 0x2, 0x15c,
|
||||
0x15d, 0x7, 0x71, 0x2, 0x2, 0x15d, 0x48, 0x3, 0x2,
|
||||
0x2, 0x2, 0x15e, 0x15f, 0x7, 0x71, 0x2, 0x2, 0x15f,
|
||||
0x160, 0x7, 0x76, 0x2, 0x2, 0x160, 0x161, 0x7, 0x6a,
|
||||
0x2, 0x2, 0x161, 0x162, 0x7, 0x67, 0x2, 0x2, 0x162,
|
||||
0x163, 0x7, 0x74, 0x2, 0x2, 0x163, 0x164, 0x7, 0x79,
|
||||
0x2, 0x2, 0x164, 0x165, 0x7, 0x6b, 0x2, 0x2, 0x165,
|
||||
0x166, 0x7, 0x75, 0x2, 0x2, 0x166, 0x167, 0x7, 0x67,
|
||||
0x2, 0x2, 0x167, 0x4a, 0x3, 0x2, 0x2, 0x2, 0x168,
|
||||
0x169, 0x7, 0x76, 0x2, 0x2, 0x169, 0x16a, 0x7, 0x74,
|
||||
0x2, 0x2, 0x16a, 0x16b, 0x7, 0x7b, 0x2, 0x2, 0x16b,
|
||||
0x4c, 0x3, 0x2, 0x2, 0x2, 0x16c, 0x16d, 0x7, 0x6e,
|
||||
0x2, 0x2, 0x16d, 0x16e, 0x7, 0x63, 0x2, 0x2, 0x16e,
|
||||
0x16f, 0x7, 0x64, 0x2, 0x2, 0x16f, 0x170, 0x7, 0x67,
|
||||
0x2, 0x2, 0x170, 0x171, 0x7, 0x6e, 0x2, 0x2, 0x171,
|
||||
0x4e, 0x3, 0x2, 0x2, 0x2, 0x172, 0x173, 0x7, 0x6e,
|
||||
0x2, 0x2, 0x173, 0x174, 0x7, 0x63, 0x2, 0x2, 0x174,
|
||||
0x175, 0x7, 0x64, 0x2, 0x2, 0x175, 0x176, 0x7, 0x67,
|
||||
0x2, 0x2, 0x176, 0x177, 0x7, 0x6e, 0x2, 0x2, 0x177,
|
||||
0x178, 0x7, 0x75, 0x2, 0x2, 0x178, 0x50, 0x3, 0x2,
|
||||
0x2, 0x2, 0x179, 0x17a, 0x7, 0x76, 0x2, 0x2, 0x17a,
|
||||
0x17b, 0x7, 0x63, 0x2, 0x2, 0x17b, 0x17c, 0x7, 0x6b,
|
||||
0x2, 0x2, 0x17c, 0x17d, 0x7, 0x6e, 0x2, 0x2, 0x17d,
|
||||
0x52, 0x3, 0x2, 0x2, 0x2, 0x17e, 0x17f, 0x7, 0x6b,
|
||||
0x2, 0x2, 0x17f, 0x180, 0x7, 0x75, 0x2, 0x2, 0x180,
|
||||
0x181, 0x7, 0x70, 0x2, 0x2, 0x181, 0x182, 0x7, 0x76,
|
||||
0x2, 0x2, 0x182, 0x54, 0x3, 0x2, 0x2, 0x2, 0x183,
|
||||
0x184, 0x7, 0x6b, 0x2, 0x2, 0x184, 0x185, 0x7, 0x75,
|
||||
0x2, 0x2, 0x185, 0x56, 0x3, 0x2, 0x2, 0x2, 0x186,
|
||||
0x187, 0x7, 0x6e, 0x2, 0x2, 0x187, 0x188, 0x7, 0x67,
|
||||
0x2, 0x2, 0x188, 0x189, 0x7, 0x76, 0x2, 0x2, 0x189,
|
||||
0x58, 0x3, 0x2, 0x2, 0x2, 0x18a, 0x18b, 0x7, 0x65,
|
||||
0x2, 0x2, 0x18b, 0x18c, 0x7, 0x71, 0x2, 0x2, 0x18c,
|
||||
0x18d, 0x7, 0x70, 0x2, 0x2, 0x18d, 0x18e, 0x7, 0x75,
|
||||
0x2, 0x2, 0x18e, 0x18f, 0x7, 0x76, 0x2, 0x2, 0x18f,
|
||||
0x5a, 0x3, 0x2, 0x2, 0x2, 0x190, 0x191, 0x7, 0x67,
|
||||
0x2, 0x2, 0x191, 0x192, 0x7, 0x7a, 0x2, 0x2, 0x192,
|
||||
0x193, 0x7, 0x76, 0x2, 0x2, 0x193, 0x194, 0x7, 0x67,
|
||||
0x2, 0x2, 0x194, 0x195, 0x7, 0x74, 0x2, 0x2, 0x195,
|
||||
0x196, 0x7, 0x70, 0x2, 0x2, 0x196, 0x5c, 0x3, 0x2,
|
||||
0x2, 0x2, 0x197, 0x198, 0x7, 0x63, 0x2, 0x2, 0x198,
|
||||
0x199, 0x7, 0x75, 0x2, 0x2, 0x199, 0x19a, 0x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3e, 0x2, 0x2, 0x1fe, 0x8a, 0x3, 0x2,
|
||||
0x2, 0x2, 0x1ff, 0x200, 0x7, 0x40, 0x2, 0x2, 0x200,
|
||||
0x201, 0x7, 0x40, 0x2, 0x2, 0x201, 0x8c, 0x3, 0x2,
|
||||
0x2, 0x2, 0x202, 0x203, 0x7, 0x40, 0x2, 0x2, 0x203,
|
||||
0x204, 0x7, 0x40, 0x2, 0x2, 0x204, 0x205, 0x7, 0x40,
|
||||
0x2, 0x2, 0x205, 0x8e, 0x3, 0x2, 0x2, 0x2, 0x206,
|
||||
0x207, 0x7, 0x30, 0x2, 0x2, 0x207, 0x208, 0x7, 0x30,
|
||||
0x2, 0x2, 0x208, 0x209, 0x7, 0x30, 0x2, 0x2, 0x209,
|
||||
0x90, 0x3, 0x2, 0x2, 0x2, 0x20a, 0x20d, 0x5, 0x69,
|
||||
0x35, 0x2, 0x20b, 0x20d, 0x5, 0x7f, 0x40, 0x2, 0x20c,
|
||||
0x20a, 0x3, 0x2, 0x2, 0x2, 0x20c, 0x20b, 0x3, 0x2,
|
||||
0x2, 0x2, 0x20d, 0x92, 0x3, 0x2, 0x2, 0x2, 0x20e,
|
||||
0x20f, 0x7, 0x2d, 0x2, 0x2, 0x20f, 0x210, 0x7, 0x2d,
|
||||
0x2, 0x2, 0x210, 0x94, 0x3, 0x2, 0x2, 0x2, 0x211,
|
||||
0x212, 0x7, 0x2f, 0x2, 0x2, 0x212, 0x213, 0x7, 0x2f,
|
||||
0x2, 0x2, 0x213, 0x96, 0x3, 0x2, 0x2, 0x2, 0x214,
|
||||
0x215, 0x7, 0x23, 0x2, 0x2, 0x215, 0x98, 0x3, 0x2,
|
||||
0x2, 0x2, 0x216, 0x21b, 0x7, 0x24, 0x2, 0x2, 0x217,
|
||||
0x21a, 0x5, 0x9b, 0x4e, 0x2, 0x218, 0x21a, 0xa, 0x2,
|
||||
0x2, 0x2, 0x219, 0x217, 0x3, 0x2, 0x2, 0x2, 0x219,
|
||||
0x218, 0x3, 0x2, 0x2, 0x2, 0x21a, 0x21d, 0x3, 0x2,
|
||||
0x2, 0x2, 0x21b, 0x219, 0x3, 0x2, 0x2, 0x2, 0x21b,
|
||||
0x21c, 0x3, 0x2, 0x2, 0x2, 0x21c, 0x21e, 0x3, 0x2,
|
||||
0x2, 0x2, 0x21d, 0x21b, 0x3, 0x2, 0x2, 0x2, 0x21e,
|
||||
0x229, 0x7, 0x24, 0x2, 0x2, 0x21f, 0x224, 0x7, 0x29,
|
||||
0x2, 0x2, 0x220, 0x223, 0x5, 0x9b, 0x4e, 0x2, 0x221,
|
||||
0x223, 0xa, 0x3, 0x2, 0x2, 0x222, 0x220, 0x3, 0x2,
|
||||
0x2, 0x2, 0x222, 0x221, 0x3, 0x2, 0x2, 0x2, 0x223,
|
||||
0x226, 0x3, 0x2, 0x2, 0x2, 0x224, 0x222, 0x3, 0x2,
|
||||
0x2, 0x2, 0x224, 0x225, 0x3, 0x2, 0x2, 0x2, 0x225,
|
||||
0x227, 0x3, 0x2, 0x2, 0x2, 0x226, 0x224, 0x3, 0x2,
|
||||
0x2, 0x2, 0x227, 0x229, 0x7, 0x29, 0x2, 0x2, 0x228,
|
||||
0x216, 0x3, 0x2, 0x2, 0x2, 0x228, 0x21f, 0x3, 0x2,
|
||||
0x2, 0x2, 0x229, 0x9a, 0x3, 0x2, 0x2, 0x2, 0x22a,
|
||||
0x22b, 0x7, 0x5e, 0x2, 0x2, 0x22b, 0x22c, 0x9, 0x4,
|
||||
0x2, 0x2, 0x22c, 0x9c, 0x3, 0x2, 0x2, 0x2, 0x22d,
|
||||
0x231, 0x9, 0x5, 0x2, 0x2, 0x22e, 0x230, 0x9, 0x6,
|
||||
0x2, 0x2, 0x22f, 0x22e, 0x3, 0x2, 0x2, 0x2, 0x230,
|
||||
0x233, 0x3, 0x2, 0x2, 0x2, 0x231, 0x22f, 0x3, 0x2,
|
||||
0x2, 0x2, 0x231, 0x232, 0x3, 0x2, 0x2, 0x2, 0x232,
|
||||
0x9e, 0x3, 0x2, 0x2, 0x2, 0x233, 0x231, 0x3, 0x2,
|
||||
0x2, 0x2, 0x234, 0x236, 0x9, 0x7, 0x2, 0x2, 0x235,
|
||||
0x234, 0x3, 0x2, 0x2, 0x2, 0x236, 0x237, 0x3, 0x2,
|
||||
0x2, 0x2, 0x237, 0x235, 0x3, 0x2, 0x2, 0x2, 0x237,
|
||||
0x238, 0x3, 0x2, 0x2, 0x2, 0x238, 0x239, 0x3, 0x2,
|
||||
0x2, 0x2, 0x239, 0x23a, 0x8, 0x50, 0x2, 0x2, 0x23a,
|
||||
0xa0, 0x3, 0x2, 0x2, 0x2, 0x23b, 0x23c, 0x7, 0x31,
|
||||
0x2, 0x2, 0x23c, 0x23d, 0x7, 0x2c, 0x2, 0x2, 0x23d,
|
||||
0x241, 0x3, 0x2, 0x2, 0x2, 0x23e, 0x240, 0xb, 0x2,
|
||||
0x2, 0x2, 0x23f, 0x23e, 0x3, 0x2, 0x2, 0x2, 0x240,
|
||||
0x243, 0x3, 0x2, 0x2, 0x2, 0x241, 0x242, 0x3, 0x2,
|
||||
0x2, 0x2, 0x241, 0x23f, 0x3, 0x2, 0x2, 0x2, 0x242,
|
||||
0x247, 0x3, 0x2, 0x2, 0x2, 0x243, 0x241, 0x3, 0x2,
|
||||
0x2, 0x2, 0x244, 0x245, 0x7, 0x2c, 0x2, 0x2, 0x245,
|
||||
0x248, 0x7, 0x31, 0x2, 0x2, 0x246, 0x248, 0x7, 0x2,
|
||||
0x2, 0x3, 0x247, 0x244, 0x3, 0x2, 0x2, 0x2, 0x247,
|
||||
0x246, 0x3, 0x2, 0x2, 0x2, 0x248, 0x249, 0x3, 0x2,
|
||||
0x2, 0x2, 0x249, 0x24a, 0x8, 0x51, 0x2, 0x2, 0x24a,
|
||||
0xa2, 0x3, 0x2, 0x2, 0x2, 0x24b, 0x24c, 0x7, 0x31,
|
||||
0x2, 0x2, 0x24c, 0x24d, 0x7, 0x31, 0x2, 0x2, 0x24d,
|
||||
0x251, 0x3, 0x2, 0x2, 0x2, 0x24e, 0x250, 0xa, 0x8,
|
||||
0x2, 0x2, 0x24f, 0x24e, 0x3, 0x2, 0x2, 0x2, 0x250,
|
||||
0x253, 0x3, 0x2, 0x2, 0x2, 0x251, 0x24f, 0x3, 0x2,
|
||||
0x2, 0x2, 0x251, 0x252, 0x3, 0x2, 0x2, 0x2, 0x252,
|
||||
0x254, 0x3, 0x2, 0x2, 0x2, 0x253, 0x251, 0x3, 0x2,
|
||||
0x2, 0x2, 0x254, 0x255, 0x8, 0x52, 0x2, 0x2, 0x255,
|
||||
0xa4, 0x3, 0x2, 0x2, 0x2, 0x256, 0x257, 0x9, 0x9,
|
||||
0x2, 0x2, 0x257, 0xa6, 0x3, 0x2, 0x2, 0x2, 0x258,
|
||||
0x261, 0x7, 0x32, 0x2, 0x2, 0x259, 0x25d, 0x9, 0xa,
|
||||
0x2, 0x2, 0x25a, 0x25c, 0x5, 0xa5, 0x53, 0x2, 0x25b,
|
||||
0x25a, 0x3, 0x2, 0x2, 0x2, 0x25c, 0x25f, 0x3, 0x2,
|
||||
0x2, 0x2, 0x25d, 0x25b, 0x3, 0x2, 0x2, 0x2, 0x25d,
|
||||
0x25e, 0x3, 0x2, 0x2, 0x2, 0x25e, 0x261, 0x3, 0x2,
|
||||
0x2, 0x2, 0x25f, 0x25d, 0x3, 0x2, 0x2, 0x2, 0x260,
|
||||
0x258, 0x3, 0x2, 0x2, 0x2, 0x260, 0x259, 0x3, 0x2,
|
||||
0x2, 0x2, 0x261, 0xa8, 0x3, 0x2, 0x2, 0x2, 0x262,
|
||||
0x264, 0x9, 0xb, 0x2, 0x2, 0x263, 0x265, 0x9, 0xc,
|
||||
0x2, 0x2, 0x264, 0x263, 0x3, 0x2, 0x2, 0x2, 0x264,
|
||||
0x265, 0x3, 0x2, 0x2, 0x2, 0x265, 0x267, 0x3, 0x2,
|
||||
0x2, 0x2, 0x266, 0x268, 0x5, 0xa5, 0x53, 0x2, 0x267,
|
||||
0x266, 0x3, 0x2, 0x2, 0x2, 0x268, 0x269, 0x3, 0x2,
|
||||
0x2, 0x2, 0x269, 0x267, 0x3, 0x2, 0x2, 0x2, 0x269,
|
||||
0x26a, 0x3, 0x2, 0x2, 0x2, 0x26a, 0xaa, 0x3, 0x2,
|
||||
0x2, 0x2, 0x26b, 0x26d, 0x5, 0x6d, 0x37, 0x2, 0x26c,
|
||||
0x26b, 0x3, 0x2, 0x2, 0x2, 0x26c, 0x26d, 0x3, 0x2,
|
||||
0x2, 0x2, 0x26d, 0x26e, 0x3, 0x2, 0x2, 0x2, 0x26e,
|
||||
0x26f, 0x5, 0xa7, 0x54, 0x2, 0x26f, 0x273, 0x7, 0x30,
|
||||
0x2, 0x2, 0x270, 0x272, 0x5, 0xa5, 0x53, 0x2, 0x271,
|
||||
0x270, 0x3, 0x2, 0x2, 0x2, 0x272, 0x275, 0x3, 0x2,
|
||||
0x2, 0x2, 0x273, 0x271, 0x3, 0x2, 0x2, 0x2, 0x273,
|
||||
0x274, 0x3, 0x2, 0x2, 0x2, 0x274, 0x277, 0x3, 0x2,
|
||||
0x2, 0x2, 0x275, 0x273, 0x3, 0x2, 0x2, 0x2, 0x276,
|
||||
0x278, 0x5, 0xa9, 0x55, 0x2, 0x277, 0x276, 0x3, 0x2,
|
||||
0x2, 0x2, 0x277, 0x278, 0x3, 0x2, 0x2, 0x2, 0x278,
|
||||
0x298, 0x3, 0x2, 0x2, 0x2, 0x279, 0x27b, 0x5, 0x6d,
|
||||
0x37, 0x2, 0x27a, 0x279, 0x3, 0x2, 0x2, 0x2, 0x27a,
|
||||
0x27b, 0x3, 0x2, 0x2, 0x2, 0x27b, 0x27c, 0x3, 0x2,
|
||||
0x2, 0x2, 0x27c, 0x27e, 0x7, 0x30, 0x2, 0x2, 0x27d,
|
||||
0x27f, 0x5, 0xa5, 0x53, 0x2, 0x27e, 0x27d, 0x3, 0x2,
|
||||
0x2, 0x2, 0x27f, 0x280, 0x3, 0x2, 0x2, 0x2, 0x280,
|
||||
0x27e, 0x3, 0x2, 0x2, 0x2, 0x280, 0x281, 0x3, 0x2,
|
||||
0x2, 0x2, 0x281, 0x283, 0x3, 0x2, 0x2, 0x2, 0x282,
|
||||
0x284, 0x5, 0xa9, 0x55, 0x2, 0x283, 0x282, 0x3, 0x2,
|
||||
0x2, 0x2, 0x283, 0x284, 0x3, 0x2, 0x2, 0x2, 0x284,
|
||||
0x298, 0x3, 0x2, 0x2, 0x2, 0x285, 0x287, 0x5, 0x6d,
|
||||
0x37, 0x2, 0x286, 0x285, 0x3, 0x2, 0x2, 0x2, 0x286,
|
||||
0x287, 0x3, 0x2, 0x2, 0x2, 0x287, 0x288, 0x3, 0x2,
|
||||
0x2, 0x2, 0x288, 0x28a, 0x5, 0xa7, 0x54, 0x2, 0x289,
|
||||
0x28b, 0x5, 0xa9, 0x55, 0x2, 0x28a, 0x289, 0x3, 0x2,
|
||||
0x2, 0x2, 0x28a, 0x28b, 0x3, 0x2, 0x2, 0x2, 0x28b,
|
||||
0x298, 0x3, 0x2, 0x2, 0x2, 0x28c, 0x28e, 0x5, 0x6d,
|
||||
0x37, 0x2, 0x28d, 0x28c, 0x3, 0x2, 0x2, 0x2, 0x28d,
|
||||
0x28e, 0x3, 0x2, 0x2, 0x2, 0x28e, 0x28f, 0x3, 0x2,
|
||||
0x2, 0x2, 0x28f, 0x290, 0x7, 0x32, 0x2, 0x2, 0x290,
|
||||
0x291, 0x7, 0x7a, 0x2, 0x2, 0x291, 0x293, 0x3, 0x2,
|
||||
0x2, 0x2, 0x292, 0x294, 0x9, 0xd, 0x2, 0x2, 0x293,
|
||||
0x292, 0x3, 0x2, 0x2, 0x2, 0x294, 0x295, 0x3, 0x2,
|
||||
0x2, 0x2, 0x295, 0x293, 0x3, 0x2, 0x2, 0x2, 0x295,
|
||||
0x296, 0x3, 0x2, 0x2, 0x2, 0x296, 0x298, 0x3, 0x2,
|
||||
0x2, 0x2, 0x297, 0x26c, 0x3, 0x2, 0x2, 0x2, 0x297,
|
||||
0x27a, 0x3, 0x2, 0x2, 0x2, 0x297, 0x286, 0x3, 0x2,
|
||||
0x2, 0x2, 0x297, 0x28d, 0x3, 0x2, 0x2, 0x2, 0x298,
|
||||
0xac, 0x3, 0x2, 0x2, 0x2, 0x1e, 0x2, 0x1d2, 0x20c,
|
||||
0x219, 0x21b, 0x222, 0x224, 0x228, 0x231, 0x237, 0x241, 0x247,
|
||||
0x251, 0x25d, 0x260, 0x264, 0x269, 0x26c, 0x273, 0x277, 0x27a,
|
||||
0x280, 0x283, 0x286, 0x28a, 0x28d, 0x295, 0x297, 0x3, 0x2,
|
||||
0x3, 0x2,
|
||||
};
|
||||
|
||||
atn::ATNDeserializer deserializer;
|
||||
_atn = deserializer.deserialize(_serializedATN);
|
||||
|
||||
size_t count = _atn.getNumberOfDecisions();
|
||||
_decisionToDFA.reserve(count);
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
_decisionToDFA.emplace_back(_atn.getDecisionState(i), i);
|
||||
}
|
||||
}
|
||||
|
||||
TorqueLexer::Initializer TorqueLexer::_init;
|
@ -1,138 +0,0 @@
|
||||
// Copyright 2018 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
#ifndef V8_TORQUE_TORQUELEXER_H_
|
||||
#define V8_TORQUE_TORQUELEXER_H_
|
||||
|
||||
// Generated from Torque.g4 by ANTLR 4.7.1
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "./antlr4-runtime.h"
|
||||
|
||||
class TorqueLexer : public antlr4::Lexer {
|
||||
public:
|
||||
enum {
|
||||
T__0 = 1,
|
||||
T__1 = 2,
|
||||
T__2 = 3,
|
||||
T__3 = 4,
|
||||
T__4 = 5,
|
||||
T__5 = 6,
|
||||
T__6 = 7,
|
||||
T__7 = 8,
|
||||
T__8 = 9,
|
||||
T__9 = 10,
|
||||
T__10 = 11,
|
||||
T__11 = 12,
|
||||
T__12 = 13,
|
||||
T__13 = 14,
|
||||
T__14 = 15,
|
||||
T__15 = 16,
|
||||
T__16 = 17,
|
||||
T__17 = 18,
|
||||
T__18 = 19,
|
||||
T__19 = 20,
|
||||
T__20 = 21,
|
||||
MACRO = 22,
|
||||
BUILTIN = 23,
|
||||
RUNTIME = 24,
|
||||
MODULE = 25,
|
||||
JAVASCRIPT = 26,
|
||||
DEFERRED = 27,
|
||||
IF = 28,
|
||||
FOR = 29,
|
||||
WHILE = 30,
|
||||
RETURN = 31,
|
||||
CONSTEXPR = 32,
|
||||
CONTINUE = 33,
|
||||
BREAK = 34,
|
||||
GOTO = 35,
|
||||
OTHERWISE = 36,
|
||||
TRY = 37,
|
||||
LABEL = 38,
|
||||
LABELS = 39,
|
||||
TAIL = 40,
|
||||
ISNT = 41,
|
||||
IS = 42,
|
||||
LET = 43,
|
||||
CONST = 44,
|
||||
EXTERN = 45,
|
||||
ASSERT_TOKEN = 46,
|
||||
CHECK_TOKEN = 47,
|
||||
UNREACHABLE_TOKEN = 48,
|
||||
DEBUG_TOKEN = 49,
|
||||
ASSIGNMENT = 50,
|
||||
ASSIGNMENT_OPERATOR = 51,
|
||||
EQUAL = 52,
|
||||
PLUS = 53,
|
||||
MINUS = 54,
|
||||
MULTIPLY = 55,
|
||||
DIVIDE = 56,
|
||||
MODULO = 57,
|
||||
BIT_OR = 58,
|
||||
BIT_AND = 59,
|
||||
BIT_NOT = 60,
|
||||
MAX = 61,
|
||||
MIN = 62,
|
||||
NOT_EQUAL = 63,
|
||||
LESS_THAN = 64,
|
||||
LESS_THAN_EQUAL = 65,
|
||||
GREATER_THAN = 66,
|
||||
GREATER_THAN_EQUAL = 67,
|
||||
SHIFT_LEFT = 68,
|
||||
SHIFT_RIGHT = 69,
|
||||
SHIFT_RIGHT_ARITHMETIC = 70,
|
||||
VARARGS = 71,
|
||||
EQUALITY_OPERATOR = 72,
|
||||
INCREMENT = 73,
|
||||
DECREMENT = 74,
|
||||
NOT = 75,
|
||||
STRING_LITERAL = 76,
|
||||
IDENTIFIER = 77,
|
||||
WS = 78,
|
||||
BLOCK_COMMENT = 79,
|
||||
LINE_COMMENT = 80,
|
||||
DECIMAL_LITERAL = 81
|
||||
};
|
||||
|
||||
explicit TorqueLexer(antlr4::CharStream* input);
|
||||
~TorqueLexer();
|
||||
|
||||
std::string getGrammarFileName() const override;
|
||||
const std::vector<std::string>& getRuleNames() const override;
|
||||
|
||||
const std::vector<std::string>& getChannelNames() const override;
|
||||
const std::vector<std::string>& getModeNames() const override;
|
||||
const std::vector<std::string>& getTokenNames()
|
||||
const override; // deprecated, use vocabulary instead
|
||||
antlr4::dfa::Vocabulary& getVocabulary() const override;
|
||||
|
||||
const std::vector<uint16_t> getSerializedATN() const override;
|
||||
const antlr4::atn::ATN& getATN() const override;
|
||||
|
||||
private:
|
||||
static std::vector<antlr4::dfa::DFA> _decisionToDFA;
|
||||
static antlr4::atn::PredictionContextCache _sharedContextCache;
|
||||
static std::vector<std::string> _ruleNames;
|
||||
static std::vector<std::string> _tokenNames;
|
||||
static std::vector<std::string> _channelNames;
|
||||
static std::vector<std::string> _modeNames;
|
||||
|
||||
static std::vector<std::string> _literalNames;
|
||||
static std::vector<std::string> _symbolicNames;
|
||||
static antlr4::dfa::Vocabulary _vocabulary;
|
||||
static antlr4::atn::ATN _atn;
|
||||
static std::vector<uint16_t> _serializedATN;
|
||||
|
||||
// Individual action functions triggered by action() above.
|
||||
|
||||
// Individual semantic predicate functions triggered by sempred() above.
|
||||
|
||||
struct Initializer {
|
||||
Initializer();
|
||||
};
|
||||
static Initializer _init;
|
||||
};
|
||||
|
||||
#endif // V8_TORQUE_TORQUELEXER_H_
|
File diff suppressed because one or more lines are too long
@ -1,154 +0,0 @@
|
||||
T__0=1
|
||||
T__1=2
|
||||
T__2=3
|
||||
T__3=4
|
||||
T__4=5
|
||||
T__5=6
|
||||
T__6=7
|
||||
T__7=8
|
||||
T__8=9
|
||||
T__9=10
|
||||
T__10=11
|
||||
T__11=12
|
||||
T__12=13
|
||||
T__13=14
|
||||
T__14=15
|
||||
T__15=16
|
||||
T__16=17
|
||||
T__17=18
|
||||
T__18=19
|
||||
T__19=20
|
||||
T__20=21
|
||||
MACRO=22
|
||||
BUILTIN=23
|
||||
RUNTIME=24
|
||||
MODULE=25
|
||||
JAVASCRIPT=26
|
||||
DEFERRED=27
|
||||
IF=28
|
||||
FOR=29
|
||||
WHILE=30
|
||||
RETURN=31
|
||||
CONSTEXPR=32
|
||||
CONTINUE=33
|
||||
BREAK=34
|
||||
GOTO=35
|
||||
OTHERWISE=36
|
||||
TRY=37
|
||||
LABEL=38
|
||||
LABELS=39
|
||||
TAIL=40
|
||||
ISNT=41
|
||||
IS=42
|
||||
LET=43
|
||||
CONST=44
|
||||
EXTERN=45
|
||||
ASSERT_TOKEN=46
|
||||
CHECK_TOKEN=47
|
||||
UNREACHABLE_TOKEN=48
|
||||
DEBUG_TOKEN=49
|
||||
ASSIGNMENT=50
|
||||
ASSIGNMENT_OPERATOR=51
|
||||
EQUAL=52
|
||||
PLUS=53
|
||||
MINUS=54
|
||||
MULTIPLY=55
|
||||
DIVIDE=56
|
||||
MODULO=57
|
||||
BIT_OR=58
|
||||
BIT_AND=59
|
||||
BIT_NOT=60
|
||||
MAX=61
|
||||
MIN=62
|
||||
NOT_EQUAL=63
|
||||
LESS_THAN=64
|
||||
LESS_THAN_EQUAL=65
|
||||
GREATER_THAN=66
|
||||
GREATER_THAN_EQUAL=67
|
||||
SHIFT_LEFT=68
|
||||
SHIFT_RIGHT=69
|
||||
SHIFT_RIGHT_ARITHMETIC=70
|
||||
VARARGS=71
|
||||
EQUALITY_OPERATOR=72
|
||||
INCREMENT=73
|
||||
DECREMENT=74
|
||||
NOT=75
|
||||
STRING_LITERAL=76
|
||||
IDENTIFIER=77
|
||||
WS=78
|
||||
BLOCK_COMMENT=79
|
||||
LINE_COMMENT=80
|
||||
DECIMAL_LITERAL=81
|
||||
'('=1
|
||||
')'=2
|
||||
'=>'=3
|
||||
','=4
|
||||
':'=5
|
||||
'type'=6
|
||||
'?'=7
|
||||
'||'=8
|
||||
'&&'=9
|
||||
'.'=10
|
||||
'['=11
|
||||
']'=12
|
||||
'{'=13
|
||||
'}'=14
|
||||
';'=15
|
||||
'of'=16
|
||||
'else'=17
|
||||
'extends'=18
|
||||
'generates'=19
|
||||
'operator'=20
|
||||
'struct'=21
|
||||
'macro'=22
|
||||
'builtin'=23
|
||||
'runtime'=24
|
||||
'module'=25
|
||||
'javascript'=26
|
||||
'deferred'=27
|
||||
'if'=28
|
||||
'for'=29
|
||||
'while'=30
|
||||
'return'=31
|
||||
'constexpr'=32
|
||||
'continue'=33
|
||||
'break'=34
|
||||
'goto'=35
|
||||
'otherwise'=36
|
||||
'try'=37
|
||||
'label'=38
|
||||
'labels'=39
|
||||
'tail'=40
|
||||
'isnt'=41
|
||||
'is'=42
|
||||
'let'=43
|
||||
'const'=44
|
||||
'extern'=45
|
||||
'assert'=46
|
||||
'check'=47
|
||||
'unreachable'=48
|
||||
'debug'=49
|
||||
'='=50
|
||||
'=='=52
|
||||
'+'=53
|
||||
'-'=54
|
||||
'*'=55
|
||||
'/'=56
|
||||
'%'=57
|
||||
'|'=58
|
||||
'&'=59
|
||||
'~'=60
|
||||
'max'=61
|
||||
'min'=62
|
||||
'!='=63
|
||||
'<'=64
|
||||
'<='=65
|
||||
'>'=66
|
||||
'>='=67
|
||||
'<<'=68
|
||||
'>>'=69
|
||||
'>>>'=70
|
||||
'...'=71
|
||||
'++'=73
|
||||
'--'=74
|
||||
'!'=75
|
@ -1,7 +0,0 @@
|
||||
// Copyright 2018 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Generated from Torque.g4 by ANTLR 4.7.1
|
||||
|
||||
#include "TorqueListener.h"
|
@ -1,351 +0,0 @@
|
||||
// Copyright 2018 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
#ifndef V8_TORQUE_TORQUELISTENER_H_
|
||||
#define V8_TORQUE_TORQUELISTENER_H_
|
||||
|
||||
// Generated from Torque.g4 by ANTLR 4.7.1
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "./antlr4-runtime.h"
|
||||
#include "TorqueParser.h"
|
||||
|
||||
/**
|
||||
* This interface defines an abstract listener for a parse tree produced by
|
||||
* TorqueParser.
|
||||
*/
|
||||
class TorqueListener : public antlr4::tree::ParseTreeListener {
|
||||
public:
|
||||
virtual void enterType(TorqueParser::TypeContext* ctx) = 0;
|
||||
virtual void exitType(TorqueParser::TypeContext* ctx) = 0;
|
||||
|
||||
virtual void enterTypeList(TorqueParser::TypeListContext* ctx) = 0;
|
||||
virtual void exitTypeList(TorqueParser::TypeListContext* ctx) = 0;
|
||||
|
||||
virtual void enterGenericSpecializationTypeList(
|
||||
TorqueParser::GenericSpecializationTypeListContext* ctx) = 0;
|
||||
virtual void exitGenericSpecializationTypeList(
|
||||
TorqueParser::GenericSpecializationTypeListContext* ctx) = 0;
|
||||
|
||||
virtual void enterOptionalGenericTypeList(
|
||||
TorqueParser::OptionalGenericTypeListContext* ctx) = 0;
|
||||
virtual void exitOptionalGenericTypeList(
|
||||
TorqueParser::OptionalGenericTypeListContext* ctx) = 0;
|
||||
|
||||
virtual void enterTypeListMaybeVarArgs(
|
||||
TorqueParser::TypeListMaybeVarArgsContext* ctx) = 0;
|
||||
virtual void exitTypeListMaybeVarArgs(
|
||||
TorqueParser::TypeListMaybeVarArgsContext* ctx) = 0;
|
||||
|
||||
virtual void enterLabelParameter(
|
||||
TorqueParser::LabelParameterContext* ctx) = 0;
|
||||
virtual void exitLabelParameter(TorqueParser::LabelParameterContext* ctx) = 0;
|
||||
|
||||
virtual void enterOptionalType(TorqueParser::OptionalTypeContext* ctx) = 0;
|
||||
virtual void exitOptionalType(TorqueParser::OptionalTypeContext* ctx) = 0;
|
||||
|
||||
virtual void enterOptionalLabelList(
|
||||
TorqueParser::OptionalLabelListContext* ctx) = 0;
|
||||
virtual void exitOptionalLabelList(
|
||||
TorqueParser::OptionalLabelListContext* ctx) = 0;
|
||||
|
||||
virtual void enterOptionalOtherwise(
|
||||
TorqueParser::OptionalOtherwiseContext* ctx) = 0;
|
||||
virtual void exitOptionalOtherwise(
|
||||
TorqueParser::OptionalOtherwiseContext* ctx) = 0;
|
||||
|
||||
virtual void enterParameter(TorqueParser::ParameterContext* ctx) = 0;
|
||||
virtual void exitParameter(TorqueParser::ParameterContext* ctx) = 0;
|
||||
|
||||
virtual void enterParameterList(TorqueParser::ParameterListContext* ctx) = 0;
|
||||
virtual void exitParameterList(TorqueParser::ParameterListContext* ctx) = 0;
|
||||
|
||||
virtual void enterLabelDeclaration(
|
||||
TorqueParser::LabelDeclarationContext* ctx) = 0;
|
||||
virtual void exitLabelDeclaration(
|
||||
TorqueParser::LabelDeclarationContext* ctx) = 0;
|
||||
|
||||
virtual void enterExpression(TorqueParser::ExpressionContext* ctx) = 0;
|
||||
virtual void exitExpression(TorqueParser::ExpressionContext* ctx) = 0;
|
||||
|
||||
virtual void enterConditionalExpression(
|
||||
TorqueParser::ConditionalExpressionContext* ctx) = 0;
|
||||
virtual void exitConditionalExpression(
|
||||
TorqueParser::ConditionalExpressionContext* ctx) = 0;
|
||||
|
||||
virtual void enterLogicalORExpression(
|
||||
TorqueParser::LogicalORExpressionContext* ctx) = 0;
|
||||
virtual void exitLogicalORExpression(
|
||||
TorqueParser::LogicalORExpressionContext* ctx) = 0;
|
||||
|
||||
virtual void enterLogicalANDExpression(
|
||||
TorqueParser::LogicalANDExpressionContext* ctx) = 0;
|
||||
virtual void exitLogicalANDExpression(
|
||||
TorqueParser::LogicalANDExpressionContext* ctx) = 0;
|
||||
|
||||
virtual void enterBitwiseExpression(
|
||||
TorqueParser::BitwiseExpressionContext* ctx) = 0;
|
||||
virtual void exitBitwiseExpression(
|
||||
TorqueParser::BitwiseExpressionContext* ctx) = 0;
|
||||
|
||||
virtual void enterEqualityExpression(
|
||||
TorqueParser::EqualityExpressionContext* ctx) = 0;
|
||||
virtual void exitEqualityExpression(
|
||||
TorqueParser::EqualityExpressionContext* ctx) = 0;
|
||||
|
||||
virtual void enterRelationalExpression(
|
||||
TorqueParser::RelationalExpressionContext* ctx) = 0;
|
||||
virtual void exitRelationalExpression(
|
||||
TorqueParser::RelationalExpressionContext* ctx) = 0;
|
||||
|
||||
virtual void enterShiftExpression(
|
||||
TorqueParser::ShiftExpressionContext* ctx) = 0;
|
||||
virtual void exitShiftExpression(
|
||||
TorqueParser::ShiftExpressionContext* ctx) = 0;
|
||||
|
||||
virtual void enterAdditiveExpression(
|
||||
TorqueParser::AdditiveExpressionContext* ctx) = 0;
|
||||
virtual void exitAdditiveExpression(
|
||||
TorqueParser::AdditiveExpressionContext* ctx) = 0;
|
||||
|
||||
virtual void enterMultiplicativeExpression(
|
||||
TorqueParser::MultiplicativeExpressionContext* ctx) = 0;
|
||||
virtual void exitMultiplicativeExpression(
|
||||
TorqueParser::MultiplicativeExpressionContext* ctx) = 0;
|
||||
|
||||
virtual void enterUnaryExpression(
|
||||
TorqueParser::UnaryExpressionContext* ctx) = 0;
|
||||
virtual void exitUnaryExpression(
|
||||
TorqueParser::UnaryExpressionContext* ctx) = 0;
|
||||
|
||||
virtual void enterLocationExpression(
|
||||
TorqueParser::LocationExpressionContext* ctx) = 0;
|
||||
virtual void exitLocationExpression(
|
||||
TorqueParser::LocationExpressionContext* ctx) = 0;
|
||||
|
||||
virtual void enterIncrementDecrement(
|
||||
TorqueParser::IncrementDecrementContext* ctx) = 0;
|
||||
virtual void exitIncrementDecrement(
|
||||
TorqueParser::IncrementDecrementContext* ctx) = 0;
|
||||
|
||||
virtual void enterAssignment(TorqueParser::AssignmentContext* ctx) = 0;
|
||||
virtual void exitAssignment(TorqueParser::AssignmentContext* ctx) = 0;
|
||||
|
||||
virtual void enterAssignmentExpression(
|
||||
TorqueParser::AssignmentExpressionContext* ctx) = 0;
|
||||
virtual void exitAssignmentExpression(
|
||||
TorqueParser::AssignmentExpressionContext* ctx) = 0;
|
||||
|
||||
virtual void enterStructExpression(
|
||||
TorqueParser::StructExpressionContext* ctx) = 0;
|
||||
virtual void exitStructExpression(
|
||||
TorqueParser::StructExpressionContext* ctx) = 0;
|
||||
|
||||
virtual void enterFunctionPointerExpression(
|
||||
TorqueParser::FunctionPointerExpressionContext* ctx) = 0;
|
||||
virtual void exitFunctionPointerExpression(
|
||||
TorqueParser::FunctionPointerExpressionContext* ctx) = 0;
|
||||
|
||||
virtual void enterPrimaryExpression(
|
||||
TorqueParser::PrimaryExpressionContext* ctx) = 0;
|
||||
virtual void exitPrimaryExpression(
|
||||
TorqueParser::PrimaryExpressionContext* ctx) = 0;
|
||||
|
||||
virtual void enterForInitialization(
|
||||
TorqueParser::ForInitializationContext* ctx) = 0;
|
||||
virtual void exitForInitialization(
|
||||
TorqueParser::ForInitializationContext* ctx) = 0;
|
||||
|
||||
virtual void enterForLoop(TorqueParser::ForLoopContext* ctx) = 0;
|
||||
virtual void exitForLoop(TorqueParser::ForLoopContext* ctx) = 0;
|
||||
|
||||
virtual void enterRangeSpecifier(
|
||||
TorqueParser::RangeSpecifierContext* ctx) = 0;
|
||||
virtual void exitRangeSpecifier(TorqueParser::RangeSpecifierContext* ctx) = 0;
|
||||
|
||||
virtual void enterForOfRange(TorqueParser::ForOfRangeContext* ctx) = 0;
|
||||
virtual void exitForOfRange(TorqueParser::ForOfRangeContext* ctx) = 0;
|
||||
|
||||
virtual void enterForOfLoop(TorqueParser::ForOfLoopContext* ctx) = 0;
|
||||
virtual void exitForOfLoop(TorqueParser::ForOfLoopContext* ctx) = 0;
|
||||
|
||||
virtual void enterArgument(TorqueParser::ArgumentContext* ctx) = 0;
|
||||
virtual void exitArgument(TorqueParser::ArgumentContext* ctx) = 0;
|
||||
|
||||
virtual void enterArgumentList(TorqueParser::ArgumentListContext* ctx) = 0;
|
||||
virtual void exitArgumentList(TorqueParser::ArgumentListContext* ctx) = 0;
|
||||
|
||||
virtual void enterHelperCall(TorqueParser::HelperCallContext* ctx) = 0;
|
||||
virtual void exitHelperCall(TorqueParser::HelperCallContext* ctx) = 0;
|
||||
|
||||
virtual void enterLabelReference(
|
||||
TorqueParser::LabelReferenceContext* ctx) = 0;
|
||||
virtual void exitLabelReference(TorqueParser::LabelReferenceContext* ctx) = 0;
|
||||
|
||||
virtual void enterVariableDeclaration(
|
||||
TorqueParser::VariableDeclarationContext* ctx) = 0;
|
||||
virtual void exitVariableDeclaration(
|
||||
TorqueParser::VariableDeclarationContext* ctx) = 0;
|
||||
|
||||
virtual void enterVariableDeclarationWithInitialization(
|
||||
TorqueParser::VariableDeclarationWithInitializationContext* ctx) = 0;
|
||||
virtual void exitVariableDeclarationWithInitialization(
|
||||
TorqueParser::VariableDeclarationWithInitializationContext* ctx) = 0;
|
||||
|
||||
virtual void enterHelperCallStatement(
|
||||
TorqueParser::HelperCallStatementContext* ctx) = 0;
|
||||
virtual void exitHelperCallStatement(
|
||||
TorqueParser::HelperCallStatementContext* ctx) = 0;
|
||||
|
||||
virtual void enterExpressionStatement(
|
||||
TorqueParser::ExpressionStatementContext* ctx) = 0;
|
||||
virtual void exitExpressionStatement(
|
||||
TorqueParser::ExpressionStatementContext* ctx) = 0;
|
||||
|
||||
virtual void enterIfStatement(TorqueParser::IfStatementContext* ctx) = 0;
|
||||
virtual void exitIfStatement(TorqueParser::IfStatementContext* ctx) = 0;
|
||||
|
||||
virtual void enterWhileLoop(TorqueParser::WhileLoopContext* ctx) = 0;
|
||||
virtual void exitWhileLoop(TorqueParser::WhileLoopContext* ctx) = 0;
|
||||
|
||||
virtual void enterReturnStatement(
|
||||
TorqueParser::ReturnStatementContext* ctx) = 0;
|
||||
virtual void exitReturnStatement(
|
||||
TorqueParser::ReturnStatementContext* ctx) = 0;
|
||||
|
||||
virtual void enterBreakStatement(
|
||||
TorqueParser::BreakStatementContext* ctx) = 0;
|
||||
virtual void exitBreakStatement(TorqueParser::BreakStatementContext* ctx) = 0;
|
||||
|
||||
virtual void enterContinueStatement(
|
||||
TorqueParser::ContinueStatementContext* ctx) = 0;
|
||||
virtual void exitContinueStatement(
|
||||
TorqueParser::ContinueStatementContext* ctx) = 0;
|
||||
|
||||
virtual void enterGotoStatement(TorqueParser::GotoStatementContext* ctx) = 0;
|
||||
virtual void exitGotoStatement(TorqueParser::GotoStatementContext* ctx) = 0;
|
||||
|
||||
virtual void enterHandlerWithStatement(
|
||||
TorqueParser::HandlerWithStatementContext* ctx) = 0;
|
||||
virtual void exitHandlerWithStatement(
|
||||
TorqueParser::HandlerWithStatementContext* ctx) = 0;
|
||||
|
||||
virtual void enterTryLabelStatement(
|
||||
TorqueParser::TryLabelStatementContext* ctx) = 0;
|
||||
virtual void exitTryLabelStatement(
|
||||
TorqueParser::TryLabelStatementContext* ctx) = 0;
|
||||
|
||||
virtual void enterDiagnosticStatement(
|
||||
TorqueParser::DiagnosticStatementContext* ctx) = 0;
|
||||
virtual void exitDiagnosticStatement(
|
||||
TorqueParser::DiagnosticStatementContext* ctx) = 0;
|
||||
|
||||
virtual void enterStatement(TorqueParser::StatementContext* ctx) = 0;
|
||||
virtual void exitStatement(TorqueParser::StatementContext* ctx) = 0;
|
||||
|
||||
virtual void enterStatementList(TorqueParser::StatementListContext* ctx) = 0;
|
||||
virtual void exitStatementList(TorqueParser::StatementListContext* ctx) = 0;
|
||||
|
||||
virtual void enterStatementScope(
|
||||
TorqueParser::StatementScopeContext* ctx) = 0;
|
||||
virtual void exitStatementScope(TorqueParser::StatementScopeContext* ctx) = 0;
|
||||
|
||||
virtual void enterStatementBlock(
|
||||
TorqueParser::StatementBlockContext* ctx) = 0;
|
||||
virtual void exitStatementBlock(TorqueParser::StatementBlockContext* ctx) = 0;
|
||||
|
||||
virtual void enterHelperBody(TorqueParser::HelperBodyContext* ctx) = 0;
|
||||
virtual void exitHelperBody(TorqueParser::HelperBodyContext* ctx) = 0;
|
||||
|
||||
virtual void enterFieldDeclaration(
|
||||
TorqueParser::FieldDeclarationContext* ctx) = 0;
|
||||
virtual void exitFieldDeclaration(
|
||||
TorqueParser::FieldDeclarationContext* ctx) = 0;
|
||||
|
||||
virtual void enterFieldListDeclaration(
|
||||
TorqueParser::FieldListDeclarationContext* ctx) = 0;
|
||||
virtual void exitFieldListDeclaration(
|
||||
TorqueParser::FieldListDeclarationContext* ctx) = 0;
|
||||
|
||||
virtual void enterExtendsDeclaration(
|
||||
TorqueParser::ExtendsDeclarationContext* ctx) = 0;
|
||||
virtual void exitExtendsDeclaration(
|
||||
TorqueParser::ExtendsDeclarationContext* ctx) = 0;
|
||||
|
||||
virtual void enterGeneratesDeclaration(
|
||||
TorqueParser::GeneratesDeclarationContext* ctx) = 0;
|
||||
virtual void exitGeneratesDeclaration(
|
||||
TorqueParser::GeneratesDeclarationContext* ctx) = 0;
|
||||
|
||||
virtual void enterConstexprDeclaration(
|
||||
TorqueParser::ConstexprDeclarationContext* ctx) = 0;
|
||||
virtual void exitConstexprDeclaration(
|
||||
TorqueParser::ConstexprDeclarationContext* ctx) = 0;
|
||||
|
||||
virtual void enterTypeDeclaration(
|
||||
TorqueParser::TypeDeclarationContext* ctx) = 0;
|
||||
virtual void exitTypeDeclaration(
|
||||
TorqueParser::TypeDeclarationContext* ctx) = 0;
|
||||
|
||||
virtual void enterTypeAliasDeclaration(
|
||||
TorqueParser::TypeAliasDeclarationContext* ctx) = 0;
|
||||
virtual void exitTypeAliasDeclaration(
|
||||
TorqueParser::TypeAliasDeclarationContext* ctx) = 0;
|
||||
|
||||
virtual void enterExternalBuiltin(
|
||||
TorqueParser::ExternalBuiltinContext* ctx) = 0;
|
||||
virtual void exitExternalBuiltin(
|
||||
TorqueParser::ExternalBuiltinContext* ctx) = 0;
|
||||
|
||||
virtual void enterExternalMacro(TorqueParser::ExternalMacroContext* ctx) = 0;
|
||||
virtual void exitExternalMacro(TorqueParser::ExternalMacroContext* ctx) = 0;
|
||||
|
||||
virtual void enterExternalRuntime(
|
||||
TorqueParser::ExternalRuntimeContext* ctx) = 0;
|
||||
virtual void exitExternalRuntime(
|
||||
TorqueParser::ExternalRuntimeContext* ctx) = 0;
|
||||
|
||||
virtual void enterBuiltinDeclaration(
|
||||
TorqueParser::BuiltinDeclarationContext* ctx) = 0;
|
||||
virtual void exitBuiltinDeclaration(
|
||||
TorqueParser::BuiltinDeclarationContext* ctx) = 0;
|
||||
|
||||
virtual void enterGenericSpecialization(
|
||||
TorqueParser::GenericSpecializationContext* ctx) = 0;
|
||||
virtual void exitGenericSpecialization(
|
||||
TorqueParser::GenericSpecializationContext* ctx) = 0;
|
||||
|
||||
virtual void enterMacroDeclaration(
|
||||
TorqueParser::MacroDeclarationContext* ctx) = 0;
|
||||
virtual void exitMacroDeclaration(
|
||||
TorqueParser::MacroDeclarationContext* ctx) = 0;
|
||||
|
||||
virtual void enterExternConstDeclaration(
|
||||
TorqueParser::ExternConstDeclarationContext* ctx) = 0;
|
||||
virtual void exitExternConstDeclaration(
|
||||
TorqueParser::ExternConstDeclarationContext* ctx) = 0;
|
||||
|
||||
virtual void enterConstDeclaration(
|
||||
TorqueParser::ConstDeclarationContext* ctx) = 0;
|
||||
virtual void exitConstDeclaration(
|
||||
TorqueParser::ConstDeclarationContext* ctx) = 0;
|
||||
|
||||
virtual void enterStructDeclaration(
|
||||
TorqueParser::StructDeclarationContext* ctx) = 0;
|
||||
virtual void exitStructDeclaration(
|
||||
TorqueParser::StructDeclarationContext* ctx) = 0;
|
||||
|
||||
virtual void enterDeclaration(TorqueParser::DeclarationContext* ctx) = 0;
|
||||
virtual void exitDeclaration(TorqueParser::DeclarationContext* ctx) = 0;
|
||||
|
||||
virtual void enterModuleDeclaration(
|
||||
TorqueParser::ModuleDeclarationContext* ctx) = 0;
|
||||
virtual void exitModuleDeclaration(
|
||||
TorqueParser::ModuleDeclarationContext* ctx) = 0;
|
||||
|
||||
virtual void enterFile(TorqueParser::FileContext* ctx) = 0;
|
||||
virtual void exitFile(TorqueParser::FileContext* ctx) = 0;
|
||||
};
|
||||
|
||||
#endif // V8_TORQUE_TORQUELISTENER_H_
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,7 +0,0 @@
|
||||
// Copyright 2018 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Generated from Torque.g4 by ANTLR 4.7.1
|
||||
|
||||
#include "TorqueVisitor.h"
|
@ -1,249 +0,0 @@
|
||||
// Copyright 2018 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
#ifndef V8_TORQUE_TORQUEVISITOR_H_
|
||||
#define V8_TORQUE_TORQUEVISITOR_H_
|
||||
|
||||
// Generated from Torque.g4 by ANTLR 4.7.1
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "./antlr4-runtime.h"
|
||||
#include "TorqueParser.h"
|
||||
|
||||
/**
|
||||
* This class defines an abstract visitor for a parse tree
|
||||
* produced by TorqueParser.
|
||||
*/
|
||||
class TorqueVisitor : public antlr4::tree::AbstractParseTreeVisitor {
|
||||
public:
|
||||
/**
|
||||
* Visit parse trees produced by TorqueParser.
|
||||
*/
|
||||
virtual antlrcpp::Any visitType(TorqueParser::TypeContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitTypeList(
|
||||
TorqueParser::TypeListContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitGenericSpecializationTypeList(
|
||||
TorqueParser::GenericSpecializationTypeListContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitOptionalGenericTypeList(
|
||||
TorqueParser::OptionalGenericTypeListContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitTypeListMaybeVarArgs(
|
||||
TorqueParser::TypeListMaybeVarArgsContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitLabelParameter(
|
||||
TorqueParser::LabelParameterContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitOptionalType(
|
||||
TorqueParser::OptionalTypeContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitOptionalLabelList(
|
||||
TorqueParser::OptionalLabelListContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitOptionalOtherwise(
|
||||
TorqueParser::OptionalOtherwiseContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitParameter(
|
||||
TorqueParser::ParameterContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitParameterList(
|
||||
TorqueParser::ParameterListContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitLabelDeclaration(
|
||||
TorqueParser::LabelDeclarationContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitExpression(
|
||||
TorqueParser::ExpressionContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitConditionalExpression(
|
||||
TorqueParser::ConditionalExpressionContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitLogicalORExpression(
|
||||
TorqueParser::LogicalORExpressionContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitLogicalANDExpression(
|
||||
TorqueParser::LogicalANDExpressionContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitBitwiseExpression(
|
||||
TorqueParser::BitwiseExpressionContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitEqualityExpression(
|
||||
TorqueParser::EqualityExpressionContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitRelationalExpression(
|
||||
TorqueParser::RelationalExpressionContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitShiftExpression(
|
||||
TorqueParser::ShiftExpressionContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitAdditiveExpression(
|
||||
TorqueParser::AdditiveExpressionContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitMultiplicativeExpression(
|
||||
TorqueParser::MultiplicativeExpressionContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitUnaryExpression(
|
||||
TorqueParser::UnaryExpressionContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitLocationExpression(
|
||||
TorqueParser::LocationExpressionContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitIncrementDecrement(
|
||||
TorqueParser::IncrementDecrementContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitAssignment(
|
||||
TorqueParser::AssignmentContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitAssignmentExpression(
|
||||
TorqueParser::AssignmentExpressionContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitStructExpression(
|
||||
TorqueParser::StructExpressionContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitFunctionPointerExpression(
|
||||
TorqueParser::FunctionPointerExpressionContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitPrimaryExpression(
|
||||
TorqueParser::PrimaryExpressionContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitForInitialization(
|
||||
TorqueParser::ForInitializationContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitForLoop(TorqueParser::ForLoopContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitRangeSpecifier(
|
||||
TorqueParser::RangeSpecifierContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitForOfRange(
|
||||
TorqueParser::ForOfRangeContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitForOfLoop(
|
||||
TorqueParser::ForOfLoopContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitArgument(
|
||||
TorqueParser::ArgumentContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitArgumentList(
|
||||
TorqueParser::ArgumentListContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitHelperCall(
|
||||
TorqueParser::HelperCallContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitLabelReference(
|
||||
TorqueParser::LabelReferenceContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitVariableDeclaration(
|
||||
TorqueParser::VariableDeclarationContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitVariableDeclarationWithInitialization(
|
||||
TorqueParser::VariableDeclarationWithInitializationContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitHelperCallStatement(
|
||||
TorqueParser::HelperCallStatementContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitExpressionStatement(
|
||||
TorqueParser::ExpressionStatementContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitIfStatement(
|
||||
TorqueParser::IfStatementContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitWhileLoop(
|
||||
TorqueParser::WhileLoopContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitReturnStatement(
|
||||
TorqueParser::ReturnStatementContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitBreakStatement(
|
||||
TorqueParser::BreakStatementContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitContinueStatement(
|
||||
TorqueParser::ContinueStatementContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitGotoStatement(
|
||||
TorqueParser::GotoStatementContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitHandlerWithStatement(
|
||||
TorqueParser::HandlerWithStatementContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitTryLabelStatement(
|
||||
TorqueParser::TryLabelStatementContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitDiagnosticStatement(
|
||||
TorqueParser::DiagnosticStatementContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitStatement(
|
||||
TorqueParser::StatementContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitStatementList(
|
||||
TorqueParser::StatementListContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitStatementScope(
|
||||
TorqueParser::StatementScopeContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitStatementBlock(
|
||||
TorqueParser::StatementBlockContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitHelperBody(
|
||||
TorqueParser::HelperBodyContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitFieldDeclaration(
|
||||
TorqueParser::FieldDeclarationContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitFieldListDeclaration(
|
||||
TorqueParser::FieldListDeclarationContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitExtendsDeclaration(
|
||||
TorqueParser::ExtendsDeclarationContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitGeneratesDeclaration(
|
||||
TorqueParser::GeneratesDeclarationContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitConstexprDeclaration(
|
||||
TorqueParser::ConstexprDeclarationContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitTypeDeclaration(
|
||||
TorqueParser::TypeDeclarationContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitTypeAliasDeclaration(
|
||||
TorqueParser::TypeAliasDeclarationContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitExternalBuiltin(
|
||||
TorqueParser::ExternalBuiltinContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitExternalMacro(
|
||||
TorqueParser::ExternalMacroContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitExternalRuntime(
|
||||
TorqueParser::ExternalRuntimeContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitBuiltinDeclaration(
|
||||
TorqueParser::BuiltinDeclarationContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitGenericSpecialization(
|
||||
TorqueParser::GenericSpecializationContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitMacroDeclaration(
|
||||
TorqueParser::MacroDeclarationContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitExternConstDeclaration(
|
||||
TorqueParser::ExternConstDeclarationContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitConstDeclaration(
|
||||
TorqueParser::ConstDeclarationContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitStructDeclaration(
|
||||
TorqueParser::StructDeclarationContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitDeclaration(
|
||||
TorqueParser::DeclarationContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitModuleDeclaration(
|
||||
TorqueParser::ModuleDeclarationContext* context) = 0;
|
||||
|
||||
virtual antlrcpp::Any visitFile(TorqueParser::FileContext* context) = 0;
|
||||
};
|
||||
|
||||
#endif // V8_TORQUE_TORQUEVISITOR_H_
|
@ -1,833 +0,0 @@
|
||||
// Copyright 2018 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "src/base/macros.h"
|
||||
#include "src/torque/ast-generator.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
namespace torque {
|
||||
|
||||
namespace {
|
||||
|
||||
std::vector<std::string> GetIdentifierVector(
|
||||
std::vector<antlr4::tree::TerminalNode*> source) {
|
||||
std::vector<std::string> result;
|
||||
for (auto s : source) {
|
||||
result.push_back(s->getSymbol()->getText());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string StringLiteralUnquote(const std::string& s) {
|
||||
assert('"' == s.front() || '\'' == s.front());
|
||||
assert('"' == s.back() || '\'' == s.back());
|
||||
std::stringstream result;
|
||||
for (size_t i = 1; i < s.length() - 1; ++i) {
|
||||
if (s[i] == '\\') {
|
||||
switch (s[++i]) {
|
||||
case 'n':
|
||||
result << '\n';
|
||||
break;
|
||||
case 'r':
|
||||
result << '\r';
|
||||
break;
|
||||
case 't':
|
||||
result << '\t';
|
||||
break;
|
||||
case '\'':
|
||||
case '"':
|
||||
case '\\':
|
||||
result << s[i];
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
} else {
|
||||
result << s[i];
|
||||
}
|
||||
}
|
||||
return result.str();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
LabelAndTypesVector AstGenerator::GetOptionalLabelAndTypeList(
|
||||
TorqueParser::OptionalLabelListContext* context) {
|
||||
LabelAndTypesVector labels;
|
||||
if (context) {
|
||||
for (auto* label : context->labelParameter()) {
|
||||
LabelAndTypes new_label;
|
||||
new_label.name = label->IDENTIFIER()->getSymbol()->getText();
|
||||
if (label->typeList() != nullptr) {
|
||||
for (auto* type : label->typeList()->type()) {
|
||||
new_label.types.emplace_back(GetType(type));
|
||||
}
|
||||
}
|
||||
labels.emplace_back(new_label);
|
||||
}
|
||||
}
|
||||
return labels;
|
||||
}
|
||||
|
||||
TypeExpression* AstGenerator::GetType(TorqueParser::TypeContext* context) {
|
||||
if (context->BUILTIN()) {
|
||||
ParameterList parameters = context->typeList()->accept(this);
|
||||
TypeExpression* return_type = GetType(context->type(0));
|
||||
return RegisterNode(
|
||||
new FunctionTypeExpression(Pos(context), parameters, return_type));
|
||||
} else if (context->BIT_OR()) {
|
||||
return RegisterNode(new UnionTypeExpression(
|
||||
Pos(context), GetType(context->type(0)), GetType(context->type(1))));
|
||||
} else if (context->IDENTIFIER()) {
|
||||
bool is_constexpr = context->CONSTEXPR() != nullptr;
|
||||
std::string name = context->IDENTIFIER()->getSymbol()->getText();
|
||||
return RegisterNode(
|
||||
new BasicTypeExpression(Pos(context), is_constexpr, std::move(name)));
|
||||
} else {
|
||||
DCHECK_EQ(1, context->type().size());
|
||||
return GetType(context->type(0));
|
||||
}
|
||||
}
|
||||
|
||||
TypeExpression* AstGenerator::GetOptionalType(
|
||||
TorqueParser::OptionalTypeContext* context) {
|
||||
if (!context->type())
|
||||
return RegisterNode(new BasicTypeExpression(Pos(context), false, "void"));
|
||||
return GetType(context->type());
|
||||
}
|
||||
|
||||
std::vector<TypeExpression*> AstGenerator::GetTypeVector(
|
||||
TorqueParser::TypeListContext* type_list) {
|
||||
std::vector<TypeExpression*> result;
|
||||
for (auto t : type_list->type()) {
|
||||
result.push_back(GetType(t));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
ParameterList AstGenerator::GetOptionalParameterList(
|
||||
TorqueParser::ParameterListContext* context) {
|
||||
if (context != nullptr) {
|
||||
return context->accept(this).as<ParameterList>();
|
||||
} else {
|
||||
return ParameterList();
|
||||
}
|
||||
}
|
||||
|
||||
Statement* AstGenerator::GetOptionalHelperBody(
|
||||
TorqueParser::HelperBodyContext* context) {
|
||||
if (context) return context->accept(this).as<Statement*>();
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitParameterList(
|
||||
TorqueParser::ParameterListContext* context) {
|
||||
ParameterList result{{}, {}, context->VARARGS(), {}};
|
||||
if (context->VARARGS()) {
|
||||
result.arguments_variable = context->IDENTIFIER()->getSymbol()->getText();
|
||||
}
|
||||
for (auto* parameter : context->parameter()) {
|
||||
parameter->accept(this);
|
||||
result.names.push_back(parameter->IDENTIFIER()->getSymbol()->getText());
|
||||
result.types.push_back(GetType(parameter->type()));
|
||||
}
|
||||
return std::move(result);
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitTypeList(
|
||||
TorqueParser::TypeListContext* context) {
|
||||
ParameterList result{{}, {}, false, {}};
|
||||
result.types = GetTypeVector(context);
|
||||
return std::move(result);
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitTypeListMaybeVarArgs(
|
||||
TorqueParser::TypeListMaybeVarArgsContext* context) {
|
||||
ParameterList result{{}, {}, context->VARARGS(), {}};
|
||||
result.types.reserve(context->type().size());
|
||||
for (auto* type : context->type()) {
|
||||
result.types.push_back(GetType(type));
|
||||
}
|
||||
return std::move(result);
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitModuleDeclaration(
|
||||
TorqueParser::ModuleDeclarationContext* context) {
|
||||
ModuleDeclaration* result = RegisterNode(new ExplicitModuleDeclaration{
|
||||
Pos(context), context->IDENTIFIER()->getSymbol()->getText(), {}});
|
||||
for (auto* declaration : context->declaration()) {
|
||||
result->declarations.push_back(
|
||||
declaration->accept(this).as<Declaration*>());
|
||||
}
|
||||
return implicit_cast<Declaration*>(result);
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitMacroDeclaration(
|
||||
TorqueParser::MacroDeclarationContext* context) {
|
||||
auto generic_parameters =
|
||||
GetIdentifierVector(context->optionalGenericTypeList()->IDENTIFIER());
|
||||
MacroDeclaration* macro = RegisterNode(new TorqueMacroDeclaration{
|
||||
Pos(context), context->IDENTIFIER()->getSymbol()->getText(),
|
||||
GetOptionalParameterList(context->parameterList()),
|
||||
GetOptionalType(context->optionalType()),
|
||||
GetOptionalLabelAndTypeList(context->optionalLabelList())});
|
||||
if (auto* op = context->STRING_LITERAL()) {
|
||||
macro->op = StringLiteralUnquote(op->getSymbol()->getText());
|
||||
}
|
||||
base::Optional<Statement*> body;
|
||||
if (context->helperBody())
|
||||
body = context->helperBody()->accept(this).as<Statement*>();
|
||||
Declaration* result = nullptr;
|
||||
if (generic_parameters.size() != 0) {
|
||||
result = RegisterNode(
|
||||
new GenericDeclaration{Pos(context), macro, generic_parameters, body});
|
||||
} else {
|
||||
if (!body) ReportError("A non-generic declaration needs a body.");
|
||||
result = RegisterNode(new StandardDeclaration{Pos(context), macro, *body});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitBuiltinDeclaration(
|
||||
TorqueParser::BuiltinDeclarationContext* context) {
|
||||
auto generic_parameters =
|
||||
GetIdentifierVector(context->optionalGenericTypeList()->IDENTIFIER());
|
||||
base::Optional<Statement*> body;
|
||||
if (context->helperBody())
|
||||
body = context->helperBody()->accept(this).as<Statement*>();
|
||||
|
||||
TorqueBuiltinDeclaration* builtin = RegisterNode(new TorqueBuiltinDeclaration{
|
||||
Pos(context), context->JAVASCRIPT() != nullptr,
|
||||
context->IDENTIFIER()->getSymbol()->getText(),
|
||||
std::move(context->parameterList()->accept(this).as<ParameterList>()),
|
||||
GetOptionalType(context->optionalType())});
|
||||
|
||||
Declaration* result = nullptr;
|
||||
if (generic_parameters.size() != 0) {
|
||||
result = RegisterNode(new GenericDeclaration{Pos(context), builtin,
|
||||
generic_parameters, body});
|
||||
} else {
|
||||
if (!body) ReportError("A non-generic declaration needs a body.");
|
||||
result =
|
||||
RegisterNode(new StandardDeclaration{Pos(context), builtin, *body});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitExternalMacro(
|
||||
TorqueParser::ExternalMacroContext* context) {
|
||||
auto generic_parameters =
|
||||
GetIdentifierVector(context->optionalGenericTypeList()->IDENTIFIER());
|
||||
MacroDeclaration* macro = RegisterNode(new ExternalMacroDeclaration{
|
||||
Pos(context),
|
||||
context->IDENTIFIER()->getSymbol()->getText(),
|
||||
{},
|
||||
std::move(
|
||||
context->typeListMaybeVarArgs()->accept(this).as<ParameterList>()),
|
||||
GetOptionalType(context->optionalType()),
|
||||
GetOptionalLabelAndTypeList(context->optionalLabelList())});
|
||||
if (auto* op = context->STRING_LITERAL())
|
||||
macro->op = StringLiteralUnquote(op->getSymbol()->getText());
|
||||
Declaration* result = nullptr;
|
||||
if (generic_parameters.size() != 0) {
|
||||
result = RegisterNode(new GenericDeclaration{Pos(context), macro,
|
||||
generic_parameters, nullptr});
|
||||
} else {
|
||||
result =
|
||||
RegisterNode(new StandardDeclaration{Pos(context), macro, nullptr});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitExternalBuiltin(
|
||||
TorqueParser::ExternalBuiltinContext* context) {
|
||||
auto generic_parameters =
|
||||
GetIdentifierVector(context->optionalGenericTypeList()->IDENTIFIER());
|
||||
ExternalBuiltinDeclaration* builtin =
|
||||
RegisterNode(new ExternalBuiltinDeclaration{
|
||||
Pos(context), context->JAVASCRIPT() != nullptr,
|
||||
context->IDENTIFIER()->getSymbol()->getText(),
|
||||
std::move(context->typeList()->accept(this).as<ParameterList>()),
|
||||
GetOptionalType(context->optionalType())});
|
||||
|
||||
Declaration* result = nullptr;
|
||||
if (generic_parameters.size() != 0) {
|
||||
result = RegisterNode(new GenericDeclaration{Pos(context), builtin,
|
||||
generic_parameters, nullptr});
|
||||
} else {
|
||||
result =
|
||||
RegisterNode(new StandardDeclaration{Pos(context), builtin, nullptr});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitExternalRuntime(
|
||||
TorqueParser::ExternalRuntimeContext* context) {
|
||||
ExternalRuntimeDeclaration* runtime =
|
||||
RegisterNode(new ExternalRuntimeDeclaration{
|
||||
Pos(context), context->IDENTIFIER()->getSymbol()->getText(),
|
||||
std::move(context->typeListMaybeVarArgs()
|
||||
->accept(this)
|
||||
.as<ParameterList>()),
|
||||
GetOptionalType(context->optionalType())});
|
||||
return implicit_cast<Declaration*>(
|
||||
RegisterNode(new StandardDeclaration{Pos(context), runtime, nullptr}));
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitConstDeclaration(
|
||||
TorqueParser::ConstDeclarationContext* context) {
|
||||
auto name = context->IDENTIFIER()->getSymbol()->getText();
|
||||
auto type = GetType(context->type());
|
||||
Expression* expression =
|
||||
context->expression()->accept(this).as<Expression*>();
|
||||
return implicit_cast<Declaration*>(
|
||||
RegisterNode(new ConstDeclaration{Pos(context), name, type, expression}));
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitGenericSpecialization(
|
||||
TorqueParser::GenericSpecializationContext* context) {
|
||||
auto name = context->IDENTIFIER()->getSymbol()->getText();
|
||||
auto specialization_parameters =
|
||||
GetTypeVector(context->genericSpecializationTypeList()->typeList());
|
||||
return implicit_cast<Declaration*>(RegisterNode(new SpecializationDeclaration{
|
||||
Pos(context), name, false, specialization_parameters,
|
||||
GetOptionalParameterList(context->parameterList()),
|
||||
GetOptionalType(context->optionalType()),
|
||||
GetOptionalLabelAndTypeList(context->optionalLabelList()),
|
||||
context->helperBody()->accept(this).as<Statement*>()}));
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitExternConstDeclaration(
|
||||
TorqueParser::ExternConstDeclarationContext* context) {
|
||||
return implicit_cast<Declaration*>(RegisterNode(new ExternConstDeclaration{
|
||||
Pos(context), context->IDENTIFIER()->getSymbol()->getText(),
|
||||
GetType(context->type()),
|
||||
StringLiteralUnquote(context->generatesDeclaration()
|
||||
->STRING_LITERAL()
|
||||
->getSymbol()
|
||||
->getText())}));
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitTypeDeclaration(
|
||||
TorqueParser::TypeDeclarationContext* context) {
|
||||
TypeDeclaration* result = RegisterNode(new TypeDeclaration{
|
||||
Pos(context), context->IDENTIFIER()->getSymbol()->getText(), {}, {}});
|
||||
if (context->extendsDeclaration())
|
||||
result->extends =
|
||||
context->extendsDeclaration()->IDENTIFIER()->getSymbol()->getText();
|
||||
if (context->generatesDeclaration()) {
|
||||
result->generates = StringLiteralUnquote(context->generatesDeclaration()
|
||||
->STRING_LITERAL()
|
||||
->getSymbol()
|
||||
->getText());
|
||||
}
|
||||
if (context->constexprDeclaration()) {
|
||||
result->constexpr_generates =
|
||||
StringLiteralUnquote(context->constexprDeclaration()
|
||||
->STRING_LITERAL()
|
||||
->getSymbol()
|
||||
->getText());
|
||||
}
|
||||
return implicit_cast<Declaration*>(result);
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitTypeAliasDeclaration(
|
||||
TorqueParser::TypeAliasDeclarationContext* context) {
|
||||
TypeAliasDeclaration* result = RegisterNode(new TypeAliasDeclaration{
|
||||
Pos(context), context->IDENTIFIER()->getSymbol()->getText(),
|
||||
GetType(context->type())});
|
||||
return implicit_cast<Declaration*>(result);
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitVariableDeclaration(
|
||||
TorqueParser::VariableDeclarationContext* context) {
|
||||
bool is_const_qualified = context->CONST() != nullptr;
|
||||
return RegisterNode(
|
||||
new VarDeclarationStatement{Pos(context),
|
||||
is_const_qualified,
|
||||
context->IDENTIFIER()->getSymbol()->getText(),
|
||||
GetType(context->type()),
|
||||
{}});
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitVariableDeclarationWithInitialization(
|
||||
TorqueParser::VariableDeclarationWithInitializationContext* context) {
|
||||
VarDeclarationStatement* result =
|
||||
VarDeclarationStatement::cast(context->variableDeclaration()
|
||||
->accept(this)
|
||||
.as<VarDeclarationStatement*>());
|
||||
result->pos = Pos(context);
|
||||
if (context->expression())
|
||||
result->initializer = context->expression()->accept(this).as<Expression*>();
|
||||
return implicit_cast<Statement*>(result);
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitHelperCall(
|
||||
TorqueParser::HelperCallContext* context) {
|
||||
antlr4::tree::TerminalNode* callee;
|
||||
bool is_operator = context->MIN() || context->MAX();
|
||||
if (context->MIN()) callee = context->MIN();
|
||||
if (context->MAX()) callee = context->MAX();
|
||||
if (context->IDENTIFIER()) callee = context->IDENTIFIER();
|
||||
std::vector<std::string> labels;
|
||||
for (auto label : context->optionalOtherwise()->IDENTIFIER()) {
|
||||
labels.push_back(label->getSymbol()->getText());
|
||||
}
|
||||
std::vector<TypeExpression*> templateArguments;
|
||||
if (context->genericSpecializationTypeList()) {
|
||||
templateArguments =
|
||||
GetTypeVector(context->genericSpecializationTypeList()->typeList());
|
||||
}
|
||||
CallExpression* result =
|
||||
RegisterNode(new CallExpression{Pos(context),
|
||||
callee->getSymbol()->getText(),
|
||||
is_operator,
|
||||
templateArguments,
|
||||
{},
|
||||
labels});
|
||||
for (auto* arg : context->argumentList()->argument()) {
|
||||
result->arguments.push_back(arg->accept(this).as<Expression*>());
|
||||
}
|
||||
return implicit_cast<Expression*>(result);
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitHelperCallStatement(
|
||||
TorqueParser::HelperCallStatementContext* context) {
|
||||
Statement* result;
|
||||
if (context->TAIL()) {
|
||||
result = RegisterNode(new TailCallStatement{
|
||||
Pos(context),
|
||||
CallExpression::cast(
|
||||
context->helperCall()->accept(this).as<Expression*>())});
|
||||
} else {
|
||||
result = RegisterNode(new ExpressionStatement{
|
||||
Pos(context), context->helperCall()->accept(this).as<Expression*>()});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitStatementScope(
|
||||
TorqueParser::StatementScopeContext* context) {
|
||||
BlockStatement* result = RegisterNode(
|
||||
new BlockStatement{Pos(context), context->DEFERRED() != nullptr, {}});
|
||||
for (auto* child : context->statementList()->statement()) {
|
||||
result->statements.push_back(child->accept(this).as<Statement*>());
|
||||
}
|
||||
return implicit_cast<Statement*>(result);
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitExpressionStatement(
|
||||
TorqueParser::ExpressionStatementContext* context) {
|
||||
return implicit_cast<Statement*>(RegisterNode(new ExpressionStatement{
|
||||
Pos(context), context->assignment()->accept(this).as<Expression*>()}));
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitReturnStatement(
|
||||
TorqueParser::ReturnStatementContext* context) {
|
||||
if (context->expression() != nullptr) {
|
||||
return implicit_cast<Statement*>(RegisterNode(new ReturnStatement{
|
||||
Pos(context), context->expression()->accept(this).as<Expression*>()}));
|
||||
} else {
|
||||
return implicit_cast<Statement*>(
|
||||
RegisterNode(new ReturnStatement{Pos(context), {}}));
|
||||
}
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitBreakStatement(
|
||||
TorqueParser::BreakStatementContext* context) {
|
||||
return implicit_cast<Statement*>(
|
||||
RegisterNode(new BreakStatement{Pos(context)}));
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitContinueStatement(
|
||||
TorqueParser::ContinueStatementContext* context) {
|
||||
return implicit_cast<Statement*>(
|
||||
RegisterNode(new ContinueStatement{Pos(context)}));
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitGotoStatement(
|
||||
TorqueParser::GotoStatementContext* context) {
|
||||
GotoStatement* result = RegisterNode(new GotoStatement{Pos(context), {}, {}});
|
||||
if (context->labelReference())
|
||||
result->label =
|
||||
context->labelReference()->IDENTIFIER()->getSymbol()->getText();
|
||||
if (context->argumentList() != nullptr) {
|
||||
for (auto a : context->argumentList()->argument()) {
|
||||
result->arguments.push_back(a->accept(this).as<Expression*>());
|
||||
}
|
||||
}
|
||||
return implicit_cast<Statement*>(result);
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitIfStatement(
|
||||
TorqueParser::IfStatementContext* context) {
|
||||
IfStatement* result = RegisterNode(new IfStatement{
|
||||
Pos(context),
|
||||
std::move(context->expression()->accept(this).as<Expression*>()),
|
||||
context->CONSTEXPR() != nullptr,
|
||||
std::move(context->statementBlock(0)->accept(this).as<Statement*>()),
|
||||
{}});
|
||||
if (context->statementBlock(1))
|
||||
result->if_false =
|
||||
std::move(context->statementBlock(1)->accept(this).as<Statement*>());
|
||||
return implicit_cast<Statement*>(result);
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitWhileLoop(
|
||||
TorqueParser::WhileLoopContext* context) {
|
||||
return implicit_cast<Statement*>(RegisterNode(new WhileStatement{
|
||||
Pos(context), context->expression()->accept(this).as<Expression*>(),
|
||||
context->statementBlock()->accept(this).as<Statement*>()}));
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitForLoop(
|
||||
TorqueParser::ForLoopContext* context) {
|
||||
ForLoopStatement* result = RegisterNode(new ForLoopStatement{
|
||||
Pos(context),
|
||||
{},
|
||||
context->expression()->accept(this).as<Expression*>(),
|
||||
context->assignment()->accept(this).as<Expression*>(),
|
||||
context->statementBlock()->accept(this).as<Statement*>()});
|
||||
if (auto* init = context->forInitialization()
|
||||
->variableDeclarationWithInitialization()) {
|
||||
result->var_declaration =
|
||||
VarDeclarationStatement::cast(init->accept(this).as<Statement*>());
|
||||
}
|
||||
return implicit_cast<Statement*>(result);
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitForOfLoop(
|
||||
TorqueParser::ForOfLoopContext* context) {
|
||||
ForOfLoopStatement* result = RegisterNode(new ForOfLoopStatement{
|
||||
Pos(context),
|
||||
context->variableDeclaration()
|
||||
->accept(this)
|
||||
.as<VarDeclarationStatement*>(),
|
||||
context->expression()->accept(this).as<Expression*>(),
|
||||
{},
|
||||
{},
|
||||
context->statementBlock()->accept(this).as<Statement*>()});
|
||||
if (auto* range = context->forOfRange()->rangeSpecifier()) {
|
||||
if (auto* begin = range->begin) {
|
||||
result->begin = begin->accept(this).as<Expression*>();
|
||||
}
|
||||
if (auto* end = range->end) {
|
||||
result->end = end->accept(this).as<Expression*>();
|
||||
}
|
||||
}
|
||||
return implicit_cast<Statement*>(result);
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitTryLabelStatement(
|
||||
TorqueParser::TryLabelStatementContext* context) {
|
||||
TryLabelStatement* result = RegisterNode(new TryLabelStatement{
|
||||
Pos(context), context->statementBlock()->accept(this).as<Statement*>()});
|
||||
for (auto* handler : context->handlerWithStatement()) {
|
||||
handler->labelDeclaration()->accept(this);
|
||||
auto parameter_list = handler->labelDeclaration()->parameterList();
|
||||
ParameterList label_parameters = parameter_list == nullptr
|
||||
? ParameterList()
|
||||
: handler->labelDeclaration()
|
||||
->parameterList()
|
||||
->accept(this)
|
||||
.as<ParameterList>();
|
||||
LabelBlock* label_block = RegisterNode(new LabelBlock{
|
||||
Pos(handler->statementBlock()),
|
||||
handler->labelDeclaration()->IDENTIFIER()->getSymbol()->getText(),
|
||||
label_parameters,
|
||||
handler->statementBlock()->accept(this).as<Statement*>()});
|
||||
result->label_blocks.push_back(label_block);
|
||||
}
|
||||
return implicit_cast<Statement*>(result);
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitFunctionPointerExpression(
|
||||
TorqueParser::FunctionPointerExpressionContext* context) {
|
||||
if (context->IDENTIFIER()) {
|
||||
std::vector<TypeExpression*> templateArguments;
|
||||
if (context->genericSpecializationTypeList()) {
|
||||
templateArguments =
|
||||
GetTypeVector(context->genericSpecializationTypeList()->typeList());
|
||||
}
|
||||
return implicit_cast<Expression*>(RegisterNode(new IdentifierExpression{
|
||||
Pos(context), context->IDENTIFIER()->getSymbol()->getText(),
|
||||
std::move(templateArguments)}));
|
||||
}
|
||||
return context->primaryExpression()->accept(this);
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitPrimaryExpression(
|
||||
TorqueParser::PrimaryExpressionContext* context) {
|
||||
if (auto* e = context->helperCall()) return e->accept(this);
|
||||
if (auto* e = context->DECIMAL_LITERAL())
|
||||
return implicit_cast<Expression*>(RegisterNode(
|
||||
new NumberLiteralExpression{Pos(context), e->getSymbol()->getText()}));
|
||||
if (auto* e = context->STRING_LITERAL())
|
||||
return implicit_cast<Expression*>(RegisterNode(
|
||||
new StringLiteralExpression{Pos(context), e->getSymbol()->getText()}));
|
||||
if (context->structExpression()) {
|
||||
return context->structExpression()->accept(this);
|
||||
}
|
||||
return context->expression()->accept(this);
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitStructExpression(
|
||||
TorqueParser::StructExpressionContext* context) {
|
||||
std::vector<Expression*> expressions;
|
||||
for (auto& e : context->expression()) {
|
||||
expressions.push_back(e->accept(this).as<Expression*>());
|
||||
}
|
||||
return implicit_cast<Expression*>(RegisterNode(new StructExpression{
|
||||
Pos(context), context->IDENTIFIER()->getSymbol()->getText(),
|
||||
expressions}));
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitAssignment(
|
||||
TorqueParser::AssignmentContext* context) {
|
||||
if (auto* e = context->incrementDecrement()) return e->accept(this);
|
||||
LocationExpression* location = LocationExpression::cast(
|
||||
context->locationExpression()->accept(this).as<Expression*>());
|
||||
if (auto* e = context->expression()) {
|
||||
AssignmentExpression* result = RegisterNode(new AssignmentExpression{
|
||||
Pos(context), location, {}, e->accept(this).as<Expression*>()});
|
||||
if (auto* op_node = context->ASSIGNMENT_OPERATOR()) {
|
||||
std::string op = op_node->getSymbol()->getText();
|
||||
result->op = op.substr(0, op.length() - 1);
|
||||
}
|
||||
return implicit_cast<Expression*>(result);
|
||||
}
|
||||
return implicit_cast<Expression*>(location);
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitIncrementDecrement(
|
||||
TorqueParser::IncrementDecrementContext* context) {
|
||||
bool postfix = context->op;
|
||||
return implicit_cast<Expression*>(
|
||||
RegisterNode(new IncrementDecrementExpression{
|
||||
Pos(context),
|
||||
LocationExpression::cast(
|
||||
context->locationExpression()->accept(this).as<Expression*>()),
|
||||
context->INCREMENT() ? IncrementDecrementOperator::kIncrement
|
||||
: IncrementDecrementOperator::kDecrement,
|
||||
postfix}));
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitLocationExpression(
|
||||
TorqueParser::LocationExpressionContext* context) {
|
||||
Expression* location = nullptr;
|
||||
if (auto* p = context->primaryExpression()) {
|
||||
location = p->accept(this).as<Expression*>();
|
||||
} else if (auto* l = context->locationExpression()) {
|
||||
location = l->accept(this).as<Expression*>();
|
||||
} else {
|
||||
return implicit_cast<Expression*>(RegisterNode(new IdentifierExpression{
|
||||
Pos(context), context->IDENTIFIER()->getSymbol()->getText(), {}}));
|
||||
}
|
||||
|
||||
if (auto* e = context->expression()) {
|
||||
return implicit_cast<Expression*>(RegisterNode(new ElementAccessExpression{
|
||||
Pos(context), location, e->accept(this).as<Expression*>()}));
|
||||
}
|
||||
|
||||
return implicit_cast<Expression*>(RegisterNode(new FieldAccessExpression{
|
||||
Pos(context), location, context->IDENTIFIER()->getSymbol()->getText()}));
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitUnaryExpression(
|
||||
TorqueParser::UnaryExpressionContext* context) {
|
||||
if (auto* e = context->assignmentExpression()) return e->accept(this);
|
||||
std::vector<Expression*> args;
|
||||
args.push_back(context->unaryExpression()->accept(this).as<Expression*>());
|
||||
return implicit_cast<Expression*>(RegisterNode(new CallExpression{
|
||||
Pos(context), context->op->getText(), true, {}, std::move(args), {}}));
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitMultiplicativeExpression(
|
||||
TorqueParser::MultiplicativeExpressionContext* context) {
|
||||
auto* right = context->unaryExpression();
|
||||
if (auto* left = context->multiplicativeExpression()) {
|
||||
return implicit_cast<Expression*>(
|
||||
RegisterNode(new CallExpression{Pos(context),
|
||||
context->op->getText(),
|
||||
true,
|
||||
{},
|
||||
{left->accept(this).as<Expression*>(),
|
||||
right->accept(this).as<Expression*>()},
|
||||
{}}));
|
||||
}
|
||||
return right->accept(this);
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitAdditiveExpression(
|
||||
TorqueParser::AdditiveExpressionContext* context) {
|
||||
auto* right = context->multiplicativeExpression();
|
||||
if (auto* left = context->additiveExpression()) {
|
||||
return implicit_cast<Expression*>(
|
||||
RegisterNode(new CallExpression{Pos(context),
|
||||
context->op->getText(),
|
||||
true,
|
||||
{},
|
||||
{left->accept(this).as<Expression*>(),
|
||||
right->accept(this).as<Expression*>()},
|
||||
{}}));
|
||||
}
|
||||
return right->accept(this);
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitShiftExpression(
|
||||
TorqueParser::ShiftExpressionContext* context) {
|
||||
auto* right = context->additiveExpression();
|
||||
if (auto* left = context->shiftExpression()) {
|
||||
return implicit_cast<Expression*>(
|
||||
RegisterNode(new CallExpression{Pos(context),
|
||||
context->op->getText(),
|
||||
true,
|
||||
{},
|
||||
{left->accept(this).as<Expression*>(),
|
||||
right->accept(this).as<Expression*>()},
|
||||
{}}));
|
||||
}
|
||||
return right->accept(this);
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitRelationalExpression(
|
||||
TorqueParser::RelationalExpressionContext* context) {
|
||||
auto* right = context->shiftExpression();
|
||||
if (auto* left = context->relationalExpression()) {
|
||||
return implicit_cast<Expression*>(
|
||||
RegisterNode(new CallExpression{Pos(context),
|
||||
context->op->getText(),
|
||||
true,
|
||||
{},
|
||||
{left->accept(this).as<Expression*>(),
|
||||
right->accept(this).as<Expression*>()},
|
||||
{}}));
|
||||
}
|
||||
return right->accept(this);
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitEqualityExpression(
|
||||
TorqueParser::EqualityExpressionContext* context) {
|
||||
auto* right = context->relationalExpression();
|
||||
if (auto* left = context->equalityExpression()) {
|
||||
return implicit_cast<Expression*>(
|
||||
RegisterNode(new CallExpression{Pos(context),
|
||||
context->op->getText(),
|
||||
true,
|
||||
{},
|
||||
{left->accept(this).as<Expression*>(),
|
||||
right->accept(this).as<Expression*>()},
|
||||
{}}));
|
||||
}
|
||||
return right->accept(this);
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitBitwiseExpression(
|
||||
TorqueParser::BitwiseExpressionContext* context) {
|
||||
auto* right = context->equalityExpression();
|
||||
if (auto* left = context->bitwiseExpression()) {
|
||||
return implicit_cast<Expression*>(
|
||||
RegisterNode(new CallExpression{Pos(context),
|
||||
context->op->getText(),
|
||||
true,
|
||||
{},
|
||||
{left->accept(this).as<Expression*>(),
|
||||
right->accept(this).as<Expression*>()},
|
||||
{}}));
|
||||
}
|
||||
return right->accept(this);
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitLogicalANDExpression(
|
||||
TorqueParser::LogicalANDExpressionContext* context) {
|
||||
auto* right = context->bitwiseExpression();
|
||||
if (auto* left = context->logicalANDExpression()) {
|
||||
return implicit_cast<Expression*>(RegisterNode(new LogicalAndExpression{
|
||||
Pos(context), left->accept(this).as<Expression*>(),
|
||||
right->accept(this).as<Expression*>()}));
|
||||
}
|
||||
return right->accept(this);
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitLogicalORExpression(
|
||||
TorqueParser::LogicalORExpressionContext* context) {
|
||||
auto* right = context->logicalANDExpression();
|
||||
if (auto* left = context->logicalORExpression()) {
|
||||
return implicit_cast<Expression*>(RegisterNode(new LogicalOrExpression{
|
||||
Pos(context), left->accept(this).as<Expression*>(),
|
||||
right->accept(this).as<Expression*>()}));
|
||||
}
|
||||
return right->accept(this);
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitConditionalExpression(
|
||||
TorqueParser::ConditionalExpressionContext* context) {
|
||||
if (auto* condition = context->conditionalExpression()) {
|
||||
return implicit_cast<Expression*>(RegisterNode(new ConditionalExpression{
|
||||
Pos(context), condition->accept(this).as<Expression*>(),
|
||||
context->logicalORExpression(0)->accept(this).as<Expression*>(),
|
||||
context->logicalORExpression(1)->accept(this).as<Expression*>()}));
|
||||
}
|
||||
return context->logicalORExpression(0)->accept(this);
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitDiagnosticStatement(
|
||||
TorqueParser::DiagnosticStatementContext* context) {
|
||||
if (context->ASSERT_TOKEN() || context->CHECK_TOKEN()) {
|
||||
size_t a = context->expression()->start->getStartIndex();
|
||||
size_t b = context->expression()->stop->getStopIndex();
|
||||
antlr4::misc::Interval interval(a, b);
|
||||
std::string source = source_file_context_->stream->getText(interval);
|
||||
return implicit_cast<Statement*>(RegisterNode(new AssertStatement{
|
||||
Pos(context), context->ASSERT_TOKEN() != nullptr,
|
||||
context->expression()->accept(this).as<Expression*>(), source}));
|
||||
} else if (context->UNREACHABLE_TOKEN()) {
|
||||
return implicit_cast<Statement*>(
|
||||
RegisterNode(new DebugStatement{Pos(context), "unreachable", true}));
|
||||
} else {
|
||||
DCHECK(context->DEBUG_TOKEN());
|
||||
return implicit_cast<Statement*>(
|
||||
RegisterNode(new DebugStatement{Pos(context), "debug", false}));
|
||||
}
|
||||
}
|
||||
|
||||
antlrcpp::Any AstGenerator::visitStructDeclaration(
|
||||
TorqueParser::StructDeclarationContext* context) {
|
||||
StructDeclaration* struct_declaration = RegisterNode(new StructDeclaration{
|
||||
Pos(context), context->IDENTIFIER()->getSymbol()->getText()});
|
||||
|
||||
for (auto* fieldDeclaration :
|
||||
context->fieldListDeclaration()->fieldDeclaration()) {
|
||||
FieldNameAndType field = {
|
||||
fieldDeclaration->IDENTIFIER()->getSymbol()->getText(),
|
||||
GetType(fieldDeclaration->type())};
|
||||
struct_declaration->fields.push_back(field);
|
||||
}
|
||||
|
||||
return implicit_cast<Declaration*>(struct_declaration);
|
||||
}
|
||||
|
||||
void AstGenerator::visitSourceFile(SourceFileContext* context) {
|
||||
source_file_context_ = context;
|
||||
current_source_file_ = SourceFileMap::Get().AddSource(context->name);
|
||||
for (auto* declaration : context->file->children) {
|
||||
ast_.declarations().push_back(declaration->accept(this).as<Declaration*>());
|
||||
}
|
||||
source_file_context_ = nullptr;
|
||||
}
|
||||
|
||||
SourcePosition AstGenerator::Pos(antlr4::ParserRuleContext* context) {
|
||||
antlr4::misc::Interval i = context->getSourceInterval();
|
||||
auto token = source_file_context_->tokens->get(i.a);
|
||||
int line = static_cast<int>(token->getLine());
|
||||
int column = static_cast<int>(token->getCharPositionInLine());
|
||||
return SourcePosition{current_source_file_, line, column};
|
||||
}
|
||||
|
||||
} // namespace torque
|
||||
} // namespace internal
|
||||
} // namespace v8
|
@ -1,201 +0,0 @@
|
||||
// Copyright 2018 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef V8_TORQUE_AST_GENERATOR_H_
|
||||
#define V8_TORQUE_AST_GENERATOR_H_
|
||||
|
||||
#include "src/torque/TorqueBaseVisitor.h"
|
||||
#include "src/torque/ast.h"
|
||||
#include "src/torque/global-context.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
namespace torque {
|
||||
|
||||
class AstGenerator : public TorqueBaseVisitor {
|
||||
public:
|
||||
antlrcpp::Any visitParameterList(
|
||||
TorqueParser::ParameterListContext* context) override;
|
||||
|
||||
antlrcpp::Any visitTypeList(TorqueParser::TypeListContext* context) override;
|
||||
|
||||
antlrcpp::Any visitTypeListMaybeVarArgs(
|
||||
TorqueParser::TypeListMaybeVarArgsContext* context) override;
|
||||
|
||||
antlrcpp::Any visitModuleDeclaration(
|
||||
TorqueParser::ModuleDeclarationContext* context) override;
|
||||
|
||||
antlrcpp::Any visitMacroDeclaration(
|
||||
TorqueParser::MacroDeclarationContext* context) override;
|
||||
|
||||
antlrcpp::Any visitBuiltinDeclaration(
|
||||
TorqueParser::BuiltinDeclarationContext* context) override;
|
||||
|
||||
antlrcpp::Any visitExternalMacro(
|
||||
TorqueParser::ExternalMacroContext* context) override;
|
||||
|
||||
antlrcpp::Any visitExternalBuiltin(
|
||||
TorqueParser::ExternalBuiltinContext* context) override;
|
||||
|
||||
antlrcpp::Any visitExternalRuntime(
|
||||
TorqueParser::ExternalRuntimeContext* context) override;
|
||||
|
||||
antlrcpp::Any visitConstDeclaration(
|
||||
TorqueParser::ConstDeclarationContext* context) override;
|
||||
|
||||
antlrcpp::Any visitGenericSpecialization(
|
||||
TorqueParser::GenericSpecializationContext* context) override;
|
||||
|
||||
antlrcpp::Any visitExternConstDeclaration(
|
||||
TorqueParser::ExternConstDeclarationContext* context) override;
|
||||
|
||||
antlrcpp::Any visitTypeDeclaration(
|
||||
TorqueParser::TypeDeclarationContext* context) override;
|
||||
|
||||
antlrcpp::Any visitTypeAliasDeclaration(
|
||||
TorqueParser::TypeAliasDeclarationContext* context) override;
|
||||
|
||||
antlrcpp::Any visitVariableDeclaration(
|
||||
TorqueParser::VariableDeclarationContext* context) override;
|
||||
|
||||
antlrcpp::Any visitVariableDeclarationWithInitialization(
|
||||
TorqueParser::VariableDeclarationWithInitializationContext* context)
|
||||
override;
|
||||
|
||||
antlrcpp::Any visitHelperCall(
|
||||
TorqueParser::HelperCallContext* context) override;
|
||||
|
||||
antlrcpp::Any visitHelperCallStatement(
|
||||
TorqueParser::HelperCallStatementContext* context) override;
|
||||
|
||||
antlrcpp::Any visitStructExpression(
|
||||
TorqueParser::StructExpressionContext* context) override;
|
||||
|
||||
antlrcpp::Any visitConditionalExpression(
|
||||
TorqueParser::ConditionalExpressionContext* context) override;
|
||||
|
||||
antlrcpp::Any visitLogicalORExpression(
|
||||
TorqueParser::LogicalORExpressionContext* context) override;
|
||||
|
||||
antlrcpp::Any visitLogicalANDExpression(
|
||||
TorqueParser::LogicalANDExpressionContext* context) override;
|
||||
|
||||
antlrcpp::Any visitBitwiseExpression(
|
||||
TorqueParser::BitwiseExpressionContext* context) override;
|
||||
|
||||
antlrcpp::Any visitEqualityExpression(
|
||||
TorqueParser::EqualityExpressionContext* context) override;
|
||||
|
||||
antlrcpp::Any visitRelationalExpression(
|
||||
TorqueParser::RelationalExpressionContext* context) override;
|
||||
|
||||
antlrcpp::Any visitShiftExpression(
|
||||
TorqueParser::ShiftExpressionContext* context) override;
|
||||
|
||||
antlrcpp::Any visitAdditiveExpression(
|
||||
TorqueParser::AdditiveExpressionContext* context) override;
|
||||
|
||||
antlrcpp::Any visitMultiplicativeExpression(
|
||||
TorqueParser::MultiplicativeExpressionContext* context) override;
|
||||
|
||||
antlrcpp::Any visitUnaryExpression(
|
||||
TorqueParser::UnaryExpressionContext* context) override;
|
||||
|
||||
antlrcpp::Any visitLocationExpression(
|
||||
TorqueParser::LocationExpressionContext* locationExpression) override;
|
||||
|
||||
antlrcpp::Any visitIncrementDecrement(
|
||||
TorqueParser::IncrementDecrementContext* context) override;
|
||||
|
||||
antlrcpp::Any visitAssignment(
|
||||
TorqueParser::AssignmentContext* context) override;
|
||||
|
||||
antlrcpp::Any visitFunctionPointerExpression(
|
||||
TorqueParser::FunctionPointerExpressionContext* context) override;
|
||||
|
||||
antlrcpp::Any visitPrimaryExpression(
|
||||
TorqueParser::PrimaryExpressionContext* context) override;
|
||||
|
||||
antlrcpp::Any visitTryLabelStatement(
|
||||
TorqueParser::TryLabelStatementContext* context) override;
|
||||
|
||||
antlrcpp::Any visitStatementScope(
|
||||
TorqueParser::StatementScopeContext* context) override;
|
||||
|
||||
antlrcpp::Any visitExpressionStatement(
|
||||
TorqueParser::ExpressionStatementContext* context) override;
|
||||
|
||||
antlrcpp::Any visitReturnStatement(
|
||||
TorqueParser::ReturnStatementContext* context) override;
|
||||
|
||||
antlrcpp::Any visitGotoStatement(
|
||||
TorqueParser::GotoStatementContext* context) override;
|
||||
|
||||
antlrcpp::Any visitIfStatement(
|
||||
TorqueParser::IfStatementContext* context) override;
|
||||
|
||||
antlrcpp::Any visitWhileLoop(
|
||||
TorqueParser::WhileLoopContext* context) override;
|
||||
|
||||
antlrcpp::Any visitBreakStatement(
|
||||
TorqueParser::BreakStatementContext* context) override;
|
||||
|
||||
antlrcpp::Any visitContinueStatement(
|
||||
TorqueParser::ContinueStatementContext* context) override;
|
||||
|
||||
antlrcpp::Any visitForLoop(TorqueParser::ForLoopContext* context) override;
|
||||
|
||||
antlrcpp::Any visitForOfLoop(
|
||||
TorqueParser::ForOfLoopContext* context) override;
|
||||
|
||||
antlrcpp::Any visitDiagnosticStatement(
|
||||
TorqueParser::DiagnosticStatementContext* context) override;
|
||||
|
||||
antlrcpp::Any visitStructDeclaration(
|
||||
TorqueParser::StructDeclarationContext* context) override;
|
||||
|
||||
antlrcpp::Any aggregateResult(antlrcpp::Any aggregate,
|
||||
const antlrcpp::Any& nextResult) override {
|
||||
if (aggregate.isNull())
|
||||
return std::move(const_cast<antlrcpp::Any&>(nextResult));
|
||||
if (nextResult.isNull()) return aggregate;
|
||||
UNREACHABLE();
|
||||
return {};
|
||||
}
|
||||
|
||||
template <class T>
|
||||
T* RegisterNode(T* node) {
|
||||
ast_.AddNode(std::unique_ptr<AstNode>(node));
|
||||
return node;
|
||||
}
|
||||
|
||||
LabelAndTypesVector GetOptionalLabelAndTypeList(
|
||||
TorqueParser::OptionalLabelListContext* context);
|
||||
TypeExpression* GetType(TorqueParser::TypeContext* context);
|
||||
TypeExpression* GetOptionalType(TorqueParser::OptionalTypeContext* context);
|
||||
std::vector<TypeExpression*> GetTypeVector(
|
||||
TorqueParser::TypeListContext* type_list);
|
||||
|
||||
ParameterList GetOptionalParameterList(
|
||||
TorqueParser::ParameterListContext* context);
|
||||
|
||||
Statement* GetOptionalHelperBody(TorqueParser::HelperBodyContext* context);
|
||||
|
||||
void visitSourceFile(SourceFileContext* context);
|
||||
|
||||
SourcePosition Pos(antlr4::ParserRuleContext* context);
|
||||
|
||||
Ast GetAst() && { return std::move(ast_); }
|
||||
|
||||
private:
|
||||
Ast ast_;
|
||||
SourceId current_source_file_;
|
||||
SourceFileContext* source_file_context_;
|
||||
};
|
||||
|
||||
} // namespace torque
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
||||
#endif // V8_TORQUE_AST_GENERATOR_H_
|
469
src/torque/ast.h
469
src/torque/ast.h
@ -11,22 +11,12 @@
|
||||
#include <vector>
|
||||
|
||||
#include "src/base/optional.h"
|
||||
#include "src/torque/contextual.h"
|
||||
#include "src/torque/source-positions.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
namespace torque {
|
||||
|
||||
enum class SourceId : int {};
|
||||
|
||||
struct SourcePosition {
|
||||
SourceId source;
|
||||
int line;
|
||||
int column;
|
||||
};
|
||||
|
||||
DECLARE_CONTEXTUAL_VARIABLE(CurrentSourcePosition, SourcePosition)
|
||||
|
||||
#define AST_EXPRESSION_NODE_KIND_LIST(V) \
|
||||
V(CallExpression) \
|
||||
V(StructExpression) \
|
||||
@ -98,7 +88,7 @@ struct AstNode {
|
||||
#undef ENUM_ITEM
|
||||
};
|
||||
|
||||
AstNode(Kind k, SourcePosition p) : kind(k), pos(p) {}
|
||||
AstNode(Kind kind, SourcePosition pos) : kind(kind), pos(pos) {}
|
||||
virtual ~AstNode() {}
|
||||
|
||||
const Kind kind;
|
||||
@ -136,36 +126,38 @@ struct AstNodeClassCheck {
|
||||
}
|
||||
|
||||
struct Expression : AstNode {
|
||||
Expression(Kind k, SourcePosition p) : AstNode(k, p) {}
|
||||
Expression(Kind kind, SourcePosition pos) : AstNode(kind, pos) {}
|
||||
DEFINE_AST_NODE_INNER_BOILERPLATE(Expression)
|
||||
};
|
||||
|
||||
struct LocationExpression : Expression {
|
||||
LocationExpression(Kind k, SourcePosition p) : Expression(k, p) {}
|
||||
LocationExpression(Kind kind, SourcePosition pos) : Expression(kind, pos) {}
|
||||
DEFINE_AST_NODE_INNER_BOILERPLATE(LocationExpression)
|
||||
};
|
||||
|
||||
struct TypeExpression : AstNode {
|
||||
TypeExpression(Kind k, SourcePosition p) : AstNode(k, p) {}
|
||||
TypeExpression(Kind kind, SourcePosition pos) : AstNode(kind, pos) {}
|
||||
DEFINE_AST_NODE_INNER_BOILERPLATE(TypeExpression)
|
||||
};
|
||||
|
||||
struct Declaration : AstNode {
|
||||
Declaration(Kind k, SourcePosition p) : AstNode(k, p) {}
|
||||
Declaration(Kind kind, SourcePosition pos) : AstNode(kind, pos) {}
|
||||
DEFINE_AST_NODE_INNER_BOILERPLATE(Declaration)
|
||||
};
|
||||
|
||||
struct Statement : AstNode {
|
||||
Statement(Kind k, SourcePosition p) : AstNode(k, p) {}
|
||||
Statement(Kind kind, SourcePosition pos) : AstNode(kind, pos) {}
|
||||
DEFINE_AST_NODE_INNER_BOILERPLATE(Statement)
|
||||
};
|
||||
|
||||
class Module;
|
||||
|
||||
struct ModuleDeclaration : Declaration {
|
||||
ModuleDeclaration(AstNode::Kind kind, SourcePosition p,
|
||||
std::vector<Declaration*> d)
|
||||
: Declaration(kind, p), module(nullptr), declarations(std::move(d)) {}
|
||||
ModuleDeclaration(AstNode::Kind kind, SourcePosition pos,
|
||||
std::vector<Declaration*> declarations)
|
||||
: Declaration(kind, pos),
|
||||
module(nullptr),
|
||||
declarations(std::move(declarations)) {}
|
||||
virtual bool IsDefault() const = 0;
|
||||
// virtual std::string GetName() const = 0;
|
||||
void SetModule(Module* m) { module = m; }
|
||||
@ -176,48 +168,24 @@ struct ModuleDeclaration : Declaration {
|
||||
|
||||
struct DefaultModuleDeclaration : ModuleDeclaration {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(DefaultModuleDeclaration)
|
||||
DefaultModuleDeclaration(SourcePosition p, std::vector<Declaration*> d)
|
||||
: ModuleDeclaration(kKind, p, d) {}
|
||||
DefaultModuleDeclaration(SourcePosition pos,
|
||||
std::vector<Declaration*> declarations)
|
||||
: ModuleDeclaration(kKind, pos, declarations) {}
|
||||
bool IsDefault() const override { return true; }
|
||||
};
|
||||
|
||||
struct ExplicitModuleDeclaration : ModuleDeclaration {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(ExplicitModuleDeclaration)
|
||||
ExplicitModuleDeclaration(SourcePosition p, std::string n,
|
||||
std::vector<Declaration*> d)
|
||||
: ModuleDeclaration(kKind, p, d), name(std::move(n)) {}
|
||||
ExplicitModuleDeclaration(SourcePosition pos, std::string name,
|
||||
std::vector<Declaration*> declarations)
|
||||
: ModuleDeclaration(kKind, pos, declarations), name(std::move(name)) {}
|
||||
bool IsDefault() const override { return false; }
|
||||
std::string name;
|
||||
};
|
||||
|
||||
class SourceFileMap : public ContextualClass<SourceFileMap> {
|
||||
public:
|
||||
SourceFileMap() {}
|
||||
const std::string& GetSource(SourceId id) const {
|
||||
return sources_[static_cast<int>(id)];
|
||||
}
|
||||
|
||||
std::string PositionAsString(SourcePosition pos) {
|
||||
return GetSource(pos.source) + ":" + std::to_string(pos.line) + ":" +
|
||||
std::to_string(pos.column);
|
||||
}
|
||||
|
||||
SourceId AddSource(std::string path) {
|
||||
sources_.push_back(std::move(path));
|
||||
return static_cast<SourceId>(sources_.size() - 1);
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<std::string> sources_;
|
||||
};
|
||||
|
||||
inline std::string PositionAsString(SourcePosition pos) {
|
||||
return SourceFileMap::Get().PositionAsString(pos);
|
||||
}
|
||||
|
||||
class Ast {
|
||||
public:
|
||||
Ast() : default_module_{SourcePosition(), {}} {}
|
||||
Ast() : default_module_{SourcePosition{CurrentSourceFile::Get(), 0, 0}, {}} {}
|
||||
|
||||
std::vector<Declaration*>& declarations() {
|
||||
return default_module_.declarations;
|
||||
@ -225,8 +193,11 @@ class Ast {
|
||||
const std::vector<Declaration*>& declarations() const {
|
||||
return default_module_.declarations;
|
||||
}
|
||||
void AddNode(std::unique_ptr<AstNode> node) {
|
||||
nodes_.emplace_back(std::move(node));
|
||||
template <class T>
|
||||
T* AddNode(std::unique_ptr<T> node) {
|
||||
T* result = node.get();
|
||||
nodes_.push_back(std::move(node));
|
||||
return result;
|
||||
}
|
||||
DefaultModuleDeclaration* default_module() { return &default_module_; }
|
||||
|
||||
@ -237,10 +208,10 @@ class Ast {
|
||||
|
||||
struct IdentifierExpression : LocationExpression {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(IdentifierExpression)
|
||||
IdentifierExpression(SourcePosition p, std::string n,
|
||||
IdentifierExpression(SourcePosition pos, std::string name,
|
||||
std::vector<TypeExpression*> args)
|
||||
: LocationExpression(kKind, p),
|
||||
name(std::move(n)),
|
||||
: LocationExpression(kKind, pos),
|
||||
name(std::move(name)),
|
||||
generic_arguments(std::move(args)) {}
|
||||
std::string name;
|
||||
std::vector<TypeExpression*> generic_arguments;
|
||||
@ -248,14 +219,15 @@ struct IdentifierExpression : LocationExpression {
|
||||
|
||||
struct CallExpression : Expression {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(CallExpression)
|
||||
CallExpression(SourcePosition p, std::string c, bool o,
|
||||
std::vector<TypeExpression*> ga, std::vector<Expression*> a,
|
||||
std::vector<std::string> l)
|
||||
: Expression(kKind, p),
|
||||
callee(p, std::move(c), std::move(ga)),
|
||||
is_operator(o),
|
||||
arguments(std::move(a)),
|
||||
labels(l) {}
|
||||
CallExpression(SourcePosition pos, std::string callee, bool is_operator,
|
||||
std::vector<TypeExpression*> generic_arguments,
|
||||
std::vector<Expression*> arguments,
|
||||
std::vector<std::string> labels)
|
||||
: Expression(kKind, pos),
|
||||
callee(pos, std::move(callee), std::move(generic_arguments)),
|
||||
is_operator(is_operator),
|
||||
arguments(std::move(arguments)),
|
||||
labels(labels) {}
|
||||
IdentifierExpression callee;
|
||||
bool is_operator;
|
||||
std::vector<Expression*> arguments;
|
||||
@ -264,33 +236,39 @@ struct CallExpression : Expression {
|
||||
|
||||
struct StructExpression : Expression {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(StructExpression)
|
||||
StructExpression(SourcePosition p, std::string n, std::vector<Expression*> e)
|
||||
: Expression(kKind, p), name(n), expressions(std::move(e)) {}
|
||||
StructExpression(SourcePosition pos, std::string name,
|
||||
std::vector<Expression*> expressions)
|
||||
: Expression(kKind, pos),
|
||||
name(name),
|
||||
expressions(std::move(expressions)) {}
|
||||
std::string name;
|
||||
std::vector<Expression*> expressions;
|
||||
};
|
||||
|
||||
struct LogicalOrExpression : Expression {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(LogicalOrExpression)
|
||||
LogicalOrExpression(SourcePosition p, Expression* l, Expression* r)
|
||||
: Expression(kKind, p), left(l), right(r) {}
|
||||
LogicalOrExpression(SourcePosition pos, Expression* left, Expression* right)
|
||||
: Expression(kKind, pos), left(left), right(right) {}
|
||||
Expression* left;
|
||||
Expression* right;
|
||||
};
|
||||
|
||||
struct LogicalAndExpression : Expression {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(LogicalAndExpression)
|
||||
LogicalAndExpression(SourcePosition p, Expression* l, Expression* r)
|
||||
: Expression(kKind, p), left(l), right(r) {}
|
||||
LogicalAndExpression(SourcePosition pos, Expression* left, Expression* right)
|
||||
: Expression(kKind, pos), left(left), right(right) {}
|
||||
Expression* left;
|
||||
Expression* right;
|
||||
};
|
||||
|
||||
struct ConditionalExpression : Expression {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(ConditionalExpression)
|
||||
ConditionalExpression(SourcePosition p, Expression* c, Expression* t,
|
||||
Expression* f)
|
||||
: Expression(kKind, p), condition(c), if_true(t), if_false(f) {}
|
||||
ConditionalExpression(SourcePosition pos, Expression* condition,
|
||||
Expression* if_true, Expression* if_false)
|
||||
: Expression(kKind, pos),
|
||||
condition(condition),
|
||||
if_true(if_true),
|
||||
if_false(if_false) {}
|
||||
Expression* condition;
|
||||
Expression* if_true;
|
||||
Expression* if_false;
|
||||
@ -298,39 +276,46 @@ struct ConditionalExpression : Expression {
|
||||
|
||||
struct StringLiteralExpression : Expression {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(StringLiteralExpression)
|
||||
StringLiteralExpression(SourcePosition p, std::string l)
|
||||
: Expression(kKind, p), literal(std::move(l)) {}
|
||||
StringLiteralExpression(SourcePosition pos, std::string literal)
|
||||
: Expression(kKind, pos), literal(std::move(literal)) {}
|
||||
std::string literal;
|
||||
};
|
||||
|
||||
struct NumberLiteralExpression : Expression {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(NumberLiteralExpression)
|
||||
NumberLiteralExpression(SourcePosition p, std::string n)
|
||||
: Expression(kKind, p), number(std::move(n)) {}
|
||||
NumberLiteralExpression(SourcePosition pos, std::string name)
|
||||
: Expression(kKind, pos), number(std::move(name)) {}
|
||||
std::string number;
|
||||
};
|
||||
|
||||
struct ElementAccessExpression : LocationExpression {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(ElementAccessExpression)
|
||||
ElementAccessExpression(SourcePosition p, Expression* a, Expression* i)
|
||||
: LocationExpression(kKind, p), array(a), index(i) {}
|
||||
ElementAccessExpression(SourcePosition pos, Expression* array,
|
||||
Expression* index)
|
||||
: LocationExpression(kKind, pos), array(array), index(index) {}
|
||||
Expression* array;
|
||||
Expression* index;
|
||||
};
|
||||
|
||||
struct FieldAccessExpression : LocationExpression {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(FieldAccessExpression)
|
||||
FieldAccessExpression(SourcePosition p, Expression* o, std::string f)
|
||||
: LocationExpression(kKind, p), object(o), field(std::move(f)) {}
|
||||
FieldAccessExpression(SourcePosition pos, Expression* object,
|
||||
std::string field)
|
||||
: LocationExpression(kKind, pos),
|
||||
object(object),
|
||||
field(std::move(field)) {}
|
||||
Expression* object;
|
||||
std::string field;
|
||||
};
|
||||
|
||||
struct AssignmentExpression : Expression {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(AssignmentExpression)
|
||||
AssignmentExpression(SourcePosition p, LocationExpression* l,
|
||||
base::Optional<std::string> o, Expression* v)
|
||||
: Expression(kKind, p), location(l), op(std::move(o)), value(v) {}
|
||||
AssignmentExpression(SourcePosition pos, LocationExpression* location,
|
||||
base::Optional<std::string> op, Expression* value)
|
||||
: Expression(kKind, pos),
|
||||
location(location),
|
||||
op(std::move(op)),
|
||||
value(value) {}
|
||||
LocationExpression* location;
|
||||
base::Optional<std::string> op;
|
||||
Expression* value;
|
||||
@ -340,9 +325,9 @@ enum class IncrementDecrementOperator { kIncrement, kDecrement };
|
||||
|
||||
struct IncrementDecrementExpression : Expression {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(IncrementDecrementExpression)
|
||||
IncrementDecrementExpression(SourcePosition p, LocationExpression* l,
|
||||
IncrementDecrementOperator o, bool pf)
|
||||
: Expression(kKind, p), location(l), op(o), postfix(pf) {}
|
||||
IncrementDecrementExpression(SourcePosition pos, LocationExpression* location,
|
||||
IncrementDecrementOperator op, bool postfix)
|
||||
: Expression(kKind, pos), location(location), op(op), postfix(postfix) {}
|
||||
LocationExpression* location;
|
||||
IncrementDecrementOperator op;
|
||||
bool postfix;
|
||||
@ -357,17 +342,21 @@ struct ParameterList {
|
||||
|
||||
struct BasicTypeExpression : TypeExpression {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(BasicTypeExpression)
|
||||
BasicTypeExpression(SourcePosition p, bool c, std::string n)
|
||||
: TypeExpression(kKind, p), is_constexpr(c), name(n) {}
|
||||
BasicTypeExpression(SourcePosition pos, bool is_constexpr, std::string name)
|
||||
: TypeExpression(kKind, pos), is_constexpr(is_constexpr), name(name) {}
|
||||
bool is_constexpr;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
struct FunctionTypeExpression : TypeExpression {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(FunctionTypeExpression)
|
||||
FunctionTypeExpression(SourcePosition p, ParameterList pl, TypeExpression* r)
|
||||
: TypeExpression(kKind, p), parameters(pl), return_type(r) {}
|
||||
ParameterList parameters;
|
||||
FunctionTypeExpression(SourcePosition pos,
|
||||
std::vector<TypeExpression*> parameters,
|
||||
TypeExpression* return_type)
|
||||
: TypeExpression(kKind, pos),
|
||||
parameters(parameters),
|
||||
return_type(return_type) {}
|
||||
std::vector<TypeExpression*> parameters;
|
||||
TypeExpression* return_type;
|
||||
};
|
||||
|
||||
@ -381,20 +370,20 @@ struct UnionTypeExpression : TypeExpression {
|
||||
|
||||
struct ExpressionStatement : Statement {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(ExpressionStatement)
|
||||
ExpressionStatement(SourcePosition p, Expression* e)
|
||||
: Statement(kKind, p), expression(e) {}
|
||||
ExpressionStatement(SourcePosition pos, Expression* expression)
|
||||
: Statement(kKind, pos), expression(expression) {}
|
||||
Expression* expression;
|
||||
};
|
||||
|
||||
struct IfStatement : Statement {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(IfStatement)
|
||||
IfStatement(SourcePosition p, Expression* c, bool cexpr, Statement* t,
|
||||
base::Optional<Statement*> f)
|
||||
: Statement(kKind, p),
|
||||
condition(c),
|
||||
is_constexpr(cexpr),
|
||||
if_true(t),
|
||||
if_false(f) {}
|
||||
IfStatement(SourcePosition pos, bool is_constexpr, Expression* condition,
|
||||
Statement* if_true, base::Optional<Statement*> if_false)
|
||||
: Statement(kKind, pos),
|
||||
condition(condition),
|
||||
is_constexpr(is_constexpr),
|
||||
if_true(if_true),
|
||||
if_false(if_false) {}
|
||||
Expression* condition;
|
||||
bool is_constexpr;
|
||||
Statement* if_true;
|
||||
@ -403,23 +392,26 @@ struct IfStatement : Statement {
|
||||
|
||||
struct WhileStatement : Statement {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(WhileStatement)
|
||||
WhileStatement(SourcePosition p, Expression* c, Statement* b)
|
||||
: Statement(kKind, p), condition(c), body(b) {}
|
||||
WhileStatement(SourcePosition pos, Expression* condition, Statement* body)
|
||||
: Statement(kKind, pos), condition(condition), body(body) {}
|
||||
Expression* condition;
|
||||
Statement* body;
|
||||
};
|
||||
|
||||
struct ReturnStatement : Statement {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(ReturnStatement)
|
||||
ReturnStatement(SourcePosition p, base::Optional<Expression*> v)
|
||||
: Statement(kKind, p), value(v) {}
|
||||
ReturnStatement(SourcePosition pos, base::Optional<Expression*> value)
|
||||
: Statement(kKind, pos), value(value) {}
|
||||
base::Optional<Expression*> value;
|
||||
};
|
||||
|
||||
struct DebugStatement : Statement {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(DebugStatement)
|
||||
DebugStatement(SourcePosition p, const std::string& r, bool n)
|
||||
: Statement(kKind, p), reason(r), never_continues(n) {}
|
||||
DebugStatement(SourcePosition pos, const std::string& reason,
|
||||
bool never_continues)
|
||||
: Statement(kKind, pos),
|
||||
reason(reason),
|
||||
never_continues(never_continues) {}
|
||||
std::string reason;
|
||||
bool never_continues;
|
||||
};
|
||||
@ -439,20 +431,22 @@ struct AssertStatement : Statement {
|
||||
|
||||
struct TailCallStatement : Statement {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(TailCallStatement)
|
||||
TailCallStatement(SourcePosition p, CallExpression* c)
|
||||
: Statement(kKind, p), call(c) {}
|
||||
TailCallStatement(SourcePosition pos, CallExpression* call)
|
||||
: Statement(kKind, pos), call(call) {}
|
||||
CallExpression* call;
|
||||
};
|
||||
|
||||
struct VarDeclarationStatement : Statement {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(VarDeclarationStatement)
|
||||
VarDeclarationStatement(SourcePosition p, bool c, std::string n,
|
||||
TypeExpression* t, base::Optional<Expression*> i)
|
||||
: Statement(kKind, p),
|
||||
const_qualified(c),
|
||||
name(std::move(n)),
|
||||
type(t),
|
||||
initializer(i) {}
|
||||
VarDeclarationStatement(
|
||||
SourcePosition pos, bool const_qualified, std::string name,
|
||||
TypeExpression* type,
|
||||
base::Optional<Expression*> initializer = base::nullopt)
|
||||
: Statement(kKind, pos),
|
||||
const_qualified(const_qualified),
|
||||
name(std::move(name)),
|
||||
type(type),
|
||||
initializer(initializer) {}
|
||||
bool const_qualified;
|
||||
std::string name;
|
||||
TypeExpression* type;
|
||||
@ -461,49 +455,61 @@ struct VarDeclarationStatement : Statement {
|
||||
|
||||
struct BreakStatement : Statement {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(BreakStatement)
|
||||
explicit BreakStatement(SourcePosition p) : Statement(kKind, p) {}
|
||||
explicit BreakStatement(SourcePosition pos) : Statement(kKind, pos) {}
|
||||
};
|
||||
|
||||
struct ContinueStatement : Statement {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(ContinueStatement)
|
||||
explicit ContinueStatement(SourcePosition p) : Statement(kKind, p) {}
|
||||
explicit ContinueStatement(SourcePosition pos) : Statement(kKind, pos) {}
|
||||
};
|
||||
|
||||
struct GotoStatement : Statement {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(GotoStatement)
|
||||
GotoStatement(SourcePosition p, std::string l,
|
||||
const std::vector<Expression*>& a)
|
||||
: Statement(kKind, p), label(std::move(l)), arguments(std::move(a)) {}
|
||||
GotoStatement(SourcePosition pos, std::string label,
|
||||
const std::vector<Expression*>& arguments)
|
||||
: Statement(kKind, pos),
|
||||
label(std::move(label)),
|
||||
arguments(std::move(arguments)) {}
|
||||
std::string label;
|
||||
std::vector<Expression*> arguments;
|
||||
};
|
||||
|
||||
struct ForLoopStatement : Statement {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(ForLoopStatement)
|
||||
ForLoopStatement(SourcePosition p, base::Optional<VarDeclarationStatement*> d,
|
||||
Expression* t, Expression* a, Statement* b)
|
||||
: Statement(kKind, p),
|
||||
var_declaration(d),
|
||||
test(std::move(t)),
|
||||
action(std::move(a)),
|
||||
body(std::move(b)) {}
|
||||
ForLoopStatement(SourcePosition pos, base::Optional<Statement*> declaration,
|
||||
Expression* test, Expression* action, Statement* body)
|
||||
: Statement(kKind, pos),
|
||||
var_declaration(),
|
||||
test(std::move(test)),
|
||||
action(std::move(action)),
|
||||
body(std::move(body)) {
|
||||
if (declaration)
|
||||
var_declaration = VarDeclarationStatement::cast(*declaration);
|
||||
}
|
||||
base::Optional<VarDeclarationStatement*> var_declaration;
|
||||
Expression* test;
|
||||
Expression* action;
|
||||
Statement* body;
|
||||
};
|
||||
|
||||
struct RangeExpression {
|
||||
base::Optional<Expression*> begin;
|
||||
base::Optional<Expression*> end;
|
||||
};
|
||||
|
||||
struct ForOfLoopStatement : Statement {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(ForOfLoopStatement)
|
||||
ForOfLoopStatement(SourcePosition p, VarDeclarationStatement* d,
|
||||
Expression* i, base::Optional<Expression*> bg,
|
||||
base::Optional<Expression*> e, Statement* bd)
|
||||
: Statement(kKind, p),
|
||||
var_declaration(d),
|
||||
iterable(std::move(i)),
|
||||
begin(std::move(bg)),
|
||||
end(std::move(e)),
|
||||
body(std::move(bd)) {}
|
||||
ForOfLoopStatement(SourcePosition pos, Statement* decl, Expression* iterable,
|
||||
base::Optional<RangeExpression> range, Statement* body)
|
||||
: Statement(kKind, pos),
|
||||
var_declaration(VarDeclarationStatement::cast(decl)),
|
||||
iterable(iterable),
|
||||
body(body) {
|
||||
if (range) {
|
||||
begin = range->begin;
|
||||
end = range->end;
|
||||
}
|
||||
}
|
||||
VarDeclarationStatement* var_declaration;
|
||||
Expression* iterable;
|
||||
base::Optional<Expression*> begin;
|
||||
@ -513,12 +519,12 @@ struct ForOfLoopStatement : Statement {
|
||||
|
||||
struct LabelBlock : AstNode {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(LabelBlock)
|
||||
LabelBlock(SourcePosition p, const std::string& l,
|
||||
const ParameterList& p_list, Statement* b)
|
||||
: AstNode(kKind, p),
|
||||
label(std::move(l)),
|
||||
parameters(p_list),
|
||||
body(std::move(b)) {}
|
||||
LabelBlock(SourcePosition pos, const std::string& label,
|
||||
const ParameterList& parameters, Statement* body)
|
||||
: AstNode(kKind, pos),
|
||||
label(std::move(label)),
|
||||
parameters(parameters),
|
||||
body(std::move(body)) {}
|
||||
std::string label;
|
||||
ParameterList parameters;
|
||||
Statement* body;
|
||||
@ -526,28 +532,37 @@ struct LabelBlock : AstNode {
|
||||
|
||||
struct TryLabelStatement : Statement {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(TryLabelStatement)
|
||||
TryLabelStatement(SourcePosition p, Statement* t)
|
||||
: Statement(kKind, p), try_block(std::move(t)) {}
|
||||
TryLabelStatement(SourcePosition pos, Statement* try_block,
|
||||
std::vector<LabelBlock*> label_blocks)
|
||||
: Statement(kKind, pos),
|
||||
try_block(try_block),
|
||||
label_blocks(std::move(label_blocks)) {}
|
||||
Statement* try_block;
|
||||
std::vector<LabelBlock*> label_blocks;
|
||||
};
|
||||
|
||||
struct BlockStatement : Statement {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(BlockStatement)
|
||||
BlockStatement(SourcePosition p, bool d, std::vector<Statement*> s)
|
||||
: Statement(kKind, p), deferred(d), statements(std::move(s)) {}
|
||||
BlockStatement(SourcePosition pos, bool deferred,
|
||||
std::vector<Statement*> statements)
|
||||
: Statement(kKind, pos),
|
||||
deferred(deferred),
|
||||
statements(std::move(statements)) {}
|
||||
bool deferred;
|
||||
std::vector<Statement*> statements;
|
||||
};
|
||||
|
||||
struct TypeDeclaration : Declaration {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(TypeDeclaration)
|
||||
TypeDeclaration(SourcePosition p, std::string n,
|
||||
base::Optional<std::string> e, base::Optional<std::string> g)
|
||||
: Declaration(kKind, p),
|
||||
name(std::move(n)),
|
||||
extends(std::move(e)),
|
||||
generates(std::move(g)) {}
|
||||
TypeDeclaration(SourcePosition pos, std::string name,
|
||||
base::Optional<std::string> extends,
|
||||
base::Optional<std::string> generates,
|
||||
base::Optional<std::string> constexpr_generates)
|
||||
: Declaration(kKind, pos),
|
||||
name(std::move(name)),
|
||||
extends(std::move(extends)),
|
||||
generates(std::move(generates)),
|
||||
constexpr_generates(std::move(constexpr_generates)) {}
|
||||
std::string name;
|
||||
base::Optional<std::string> extends;
|
||||
base::Optional<std::string> generates;
|
||||
@ -556,13 +571,14 @@ struct TypeDeclaration : Declaration {
|
||||
|
||||
struct TypeAliasDeclaration : Declaration {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(TypeAliasDeclaration)
|
||||
TypeAliasDeclaration(SourcePosition p, std::string n, TypeExpression* t)
|
||||
: Declaration(kKind, p), name(std::move(n)), type(t) {}
|
||||
TypeAliasDeclaration(SourcePosition pos, std::string name,
|
||||
TypeExpression* type)
|
||||
: Declaration(kKind, pos), name(std::move(name)), type(type) {}
|
||||
std::string name;
|
||||
TypeExpression* type;
|
||||
};
|
||||
|
||||
struct FieldNameAndType {
|
||||
struct NameAndTypeExpression {
|
||||
std::string name;
|
||||
TypeExpression* type;
|
||||
};
|
||||
@ -581,12 +597,12 @@ struct CallableNodeSignature {
|
||||
};
|
||||
|
||||
struct CallableNode : AstNode {
|
||||
CallableNode(AstNode::Kind kind, SourcePosition p, std::string n,
|
||||
ParameterList pl, TypeExpression* r,
|
||||
const LabelAndTypesVector& l)
|
||||
: AstNode(kind, p),
|
||||
name(std::move(n)),
|
||||
signature(new CallableNodeSignature{pl, r, l}) {}
|
||||
CallableNode(AstNode::Kind kind, SourcePosition pos, std::string name,
|
||||
ParameterList parameters, TypeExpression* return_type,
|
||||
const LabelAndTypesVector& labels)
|
||||
: AstNode(kind, pos),
|
||||
name(std::move(name)),
|
||||
signature(new CallableNodeSignature{parameters, return_type, labels}) {}
|
||||
DEFINE_AST_NODE_INNER_BOILERPLATE(CallableNode)
|
||||
std::string name;
|
||||
std::unique_ptr<CallableNodeSignature> signature;
|
||||
@ -594,61 +610,79 @@ struct CallableNode : AstNode {
|
||||
|
||||
struct MacroDeclaration : CallableNode {
|
||||
DEFINE_AST_NODE_INNER_BOILERPLATE(MacroDeclaration)
|
||||
MacroDeclaration(AstNode::Kind kind, SourcePosition p, std::string n,
|
||||
base::Optional<std::string> o, ParameterList pl,
|
||||
TypeExpression* r, const LabelAndTypesVector& l)
|
||||
: CallableNode(kind, p, n, pl, r, l), op(std::move(o)) {}
|
||||
MacroDeclaration(AstNode::Kind kind, SourcePosition pos, std::string name,
|
||||
base::Optional<std::string> op, ParameterList parameters,
|
||||
TypeExpression* return_type,
|
||||
const LabelAndTypesVector& labels)
|
||||
: CallableNode(kind, pos, name, parameters, return_type, labels),
|
||||
op(std::move(op)) {}
|
||||
base::Optional<std::string> op;
|
||||
};
|
||||
|
||||
struct ExternalMacroDeclaration : MacroDeclaration {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(ExternalMacroDeclaration)
|
||||
ExternalMacroDeclaration(SourcePosition p, std::string n,
|
||||
base::Optional<std::string> o, ParameterList pl,
|
||||
TypeExpression* r, const LabelAndTypesVector& l)
|
||||
: MacroDeclaration(kKind, p, n, o, pl, r, l) {}
|
||||
ExternalMacroDeclaration(SourcePosition pos, std::string name,
|
||||
base::Optional<std::string> op,
|
||||
ParameterList parameters,
|
||||
TypeExpression* return_type,
|
||||
const LabelAndTypesVector& labels)
|
||||
: MacroDeclaration(kKind, pos, name, op, parameters, return_type,
|
||||
labels) {}
|
||||
};
|
||||
|
||||
struct TorqueMacroDeclaration : MacroDeclaration {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(TorqueMacroDeclaration)
|
||||
TorqueMacroDeclaration(SourcePosition p, std::string n, ParameterList pl,
|
||||
TypeExpression* r, const LabelAndTypesVector& l)
|
||||
: MacroDeclaration(kKind, p, n, {}, pl, r, l) {}
|
||||
TorqueMacroDeclaration(SourcePosition pos, std::string name,
|
||||
base::Optional<std::string> op,
|
||||
ParameterList parameters, TypeExpression* return_type,
|
||||
const LabelAndTypesVector& labels)
|
||||
: MacroDeclaration(kKind, pos, name, op, parameters, return_type,
|
||||
labels) {}
|
||||
};
|
||||
|
||||
struct BuiltinDeclaration : CallableNode {
|
||||
BuiltinDeclaration(AstNode::Kind kind, SourcePosition p, bool j,
|
||||
std::string n, ParameterList pl, TypeExpression* r)
|
||||
: CallableNode(kind, p, n, pl, r, {}), javascript_linkage(j) {}
|
||||
BuiltinDeclaration(AstNode::Kind kind, SourcePosition pos,
|
||||
bool javascript_linkage, std::string name,
|
||||
ParameterList parameters, TypeExpression* return_type)
|
||||
: CallableNode(kind, pos, name, parameters, return_type, {}),
|
||||
javascript_linkage(javascript_linkage) {}
|
||||
bool javascript_linkage;
|
||||
};
|
||||
|
||||
struct ExternalBuiltinDeclaration : BuiltinDeclaration {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(ExternalBuiltinDeclaration)
|
||||
ExternalBuiltinDeclaration(SourcePosition p, bool j, std::string n,
|
||||
ParameterList pl, TypeExpression* r)
|
||||
: BuiltinDeclaration(kKind, p, j, n, pl, r) {}
|
||||
ExternalBuiltinDeclaration(SourcePosition pos, bool javascript_linkage,
|
||||
std::string name, ParameterList parameters,
|
||||
TypeExpression* return_type)
|
||||
: BuiltinDeclaration(kKind, pos, javascript_linkage, name, parameters,
|
||||
return_type) {}
|
||||
};
|
||||
|
||||
struct TorqueBuiltinDeclaration : BuiltinDeclaration {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(TorqueBuiltinDeclaration)
|
||||
TorqueBuiltinDeclaration(SourcePosition p, bool j, std::string n,
|
||||
ParameterList pl, TypeExpression* r)
|
||||
: BuiltinDeclaration(kKind, p, j, n, pl, r) {}
|
||||
TorqueBuiltinDeclaration(SourcePosition pos, bool javascript_linkage,
|
||||
std::string name, ParameterList parameters,
|
||||
TypeExpression* return_type)
|
||||
: BuiltinDeclaration(kKind, pos, javascript_linkage, name, parameters,
|
||||
return_type) {}
|
||||
};
|
||||
|
||||
struct ExternalRuntimeDeclaration : CallableNode {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(ExternalRuntimeDeclaration)
|
||||
ExternalRuntimeDeclaration(SourcePosition p, std::string n, ParameterList pl,
|
||||
TypeExpression* r)
|
||||
: CallableNode(kKind, p, n, pl, r, {}) {}
|
||||
ExternalRuntimeDeclaration(SourcePosition pos, std::string name,
|
||||
ParameterList parameters,
|
||||
TypeExpression* return_type)
|
||||
: CallableNode(kKind, pos, name, parameters, return_type, {}) {}
|
||||
};
|
||||
|
||||
struct ConstDeclaration : Declaration {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(ConstDeclaration)
|
||||
ConstDeclaration(SourcePosition p, std::string n, TypeExpression* r,
|
||||
Expression* e)
|
||||
: Declaration(kKind, p), name(std::move(n)), type(r), expression(e) {}
|
||||
ConstDeclaration(SourcePosition pos, std::string name, TypeExpression* type,
|
||||
Expression* expression)
|
||||
: Declaration(kKind, pos),
|
||||
name(std::move(name)),
|
||||
type(type),
|
||||
expression(expression) {}
|
||||
std::string name;
|
||||
TypeExpression* type;
|
||||
Expression* expression;
|
||||
@ -656,21 +690,22 @@ struct ConstDeclaration : Declaration {
|
||||
|
||||
struct StandardDeclaration : Declaration {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(StandardDeclaration)
|
||||
StandardDeclaration(SourcePosition p, CallableNode* c, Statement* b)
|
||||
: Declaration(kKind, p), callable(c), body(b) {}
|
||||
StandardDeclaration(SourcePosition pos, CallableNode* callable,
|
||||
Statement* body)
|
||||
: Declaration(kKind, pos), callable(callable), body(body) {}
|
||||
CallableNode* callable;
|
||||
Statement* body;
|
||||
};
|
||||
|
||||
struct GenericDeclaration : Declaration {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(GenericDeclaration)
|
||||
GenericDeclaration(SourcePosition p, CallableNode* c,
|
||||
std::vector<std::string> gp,
|
||||
base::Optional<Statement*> b = base::nullopt)
|
||||
: Declaration(kKind, p),
|
||||
callable(c),
|
||||
generic_parameters(std::move(gp)),
|
||||
body(b) {}
|
||||
GenericDeclaration(SourcePosition pos, CallableNode* callable,
|
||||
std::vector<std::string> generic_parameters,
|
||||
base::Optional<Statement*> body = base::nullopt)
|
||||
: Declaration(kKind, pos),
|
||||
callable(callable),
|
||||
generic_parameters(std::move(generic_parameters)),
|
||||
body(body) {}
|
||||
CallableNode* callable;
|
||||
std::vector<std::string> generic_parameters;
|
||||
base::Optional<Statement*> body;
|
||||
@ -678,15 +713,16 @@ struct GenericDeclaration : Declaration {
|
||||
|
||||
struct SpecializationDeclaration : Declaration {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(SpecializationDeclaration)
|
||||
SpecializationDeclaration(SourcePosition p, std::string n, bool e,
|
||||
std::vector<TypeExpression*> gp, ParameterList pl,
|
||||
TypeExpression* r, LabelAndTypesVector l,
|
||||
Statement* b)
|
||||
: Declaration(kKind, p),
|
||||
name(std::move(n)),
|
||||
external(e),
|
||||
generic_parameters(gp),
|
||||
signature(new CallableNodeSignature{pl, r, l}),
|
||||
SpecializationDeclaration(SourcePosition pos, std::string name,
|
||||
std::vector<TypeExpression*> generic_parameters,
|
||||
ParameterList parameters,
|
||||
TypeExpression* return_type,
|
||||
LabelAndTypesVector labels, Statement* b)
|
||||
: Declaration(kKind, pos),
|
||||
name(std::move(name)),
|
||||
external(false),
|
||||
generic_parameters(generic_parameters),
|
||||
signature(new CallableNodeSignature{parameters, return_type, labels}),
|
||||
body(b) {}
|
||||
std::string name;
|
||||
bool external;
|
||||
@ -697,12 +733,12 @@ struct SpecializationDeclaration : Declaration {
|
||||
|
||||
struct ExternConstDeclaration : Declaration {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(ExternConstDeclaration)
|
||||
ExternConstDeclaration(SourcePosition p, std::string n, TypeExpression* t,
|
||||
std::string l)
|
||||
: Declaration(kKind, p),
|
||||
name(std::move(n)),
|
||||
type(t),
|
||||
literal(std::move(l)) {}
|
||||
ExternConstDeclaration(SourcePosition pos, std::string name,
|
||||
TypeExpression* type, std::string literal)
|
||||
: Declaration(kKind, pos),
|
||||
name(std::move(name)),
|
||||
type(type),
|
||||
literal(std::move(literal)) {}
|
||||
std::string name;
|
||||
TypeExpression* type;
|
||||
std::string literal;
|
||||
@ -710,10 +746,13 @@ struct ExternConstDeclaration : Declaration {
|
||||
|
||||
struct StructDeclaration : Declaration {
|
||||
DEFINE_AST_NODE_LEAF_BOILERPLATE(StructDeclaration)
|
||||
StructDeclaration(SourcePosition p, std::string n)
|
||||
: Declaration(kKind, p), name(std::move(n)) {}
|
||||
StructDeclaration(SourcePosition pos, std::string name,
|
||||
std::vector<NameAndTypeExpression> fields)
|
||||
: Declaration(kKind, pos),
|
||||
name(std::move(name)),
|
||||
fields(std::move(fields)) {}
|
||||
std::string name;
|
||||
std::vector<FieldNameAndType> fields;
|
||||
std::vector<NameAndTypeExpression> fields;
|
||||
};
|
||||
|
||||
#define ENUM_ITEM(name) \
|
||||
|
@ -85,7 +85,7 @@ const Type* Declarations::GetType(TypeExpression* type_expression) {
|
||||
} else {
|
||||
auto* function_type_exp = FunctionTypeExpression::cast(type_expression);
|
||||
TypeVector argument_types;
|
||||
for (TypeExpression* type_exp : function_type_exp->parameters.types) {
|
||||
for (TypeExpression* type_exp : function_type_exp->parameters) {
|
||||
argument_types.push_back(GetType(type_exp));
|
||||
}
|
||||
return TypeOracle::GetFunctionPointerType(
|
||||
|
303
src/torque/earley-parser.cc
Normal file
303
src/torque/earley-parser.cc
Normal file
@ -0,0 +1,303 @@
|
||||
// Copyright 2018 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include <algorithm>
|
||||
#include <set>
|
||||
#include <unordered_map>
|
||||
#include <unordered_set>
|
||||
|
||||
#include "src/torque/ast.h"
|
||||
#include "src/torque/earley-parser.h"
|
||||
#include "src/torque/utils.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
namespace torque {
|
||||
|
||||
namespace {
|
||||
|
||||
void UpdateSourcePosition(InputPosition from, InputPosition to,
|
||||
SourcePosition* pos) {
|
||||
while (from != to) {
|
||||
if (*from == '\n') {
|
||||
pos->line += 1;
|
||||
pos->column = 0;
|
||||
} else {
|
||||
pos->column += 1;
|
||||
}
|
||||
++from;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
base::Optional<ParseResult> Rule::RunAction(const Item* completed_item,
|
||||
const LexerResult& tokens) const {
|
||||
std::vector<ParseResult> results;
|
||||
for (const Item* child : completed_item->Children()) {
|
||||
if (!child) continue;
|
||||
base::Optional<ParseResult> child_result =
|
||||
child->left()->RunAction(child, tokens);
|
||||
if (child_result) results.push_back(std::move(*child_result));
|
||||
}
|
||||
MatchedInput matched_input = completed_item->GetMatchedInput(tokens);
|
||||
CurrentSourcePosition::Scope pos_scope(matched_input.pos);
|
||||
ParseResultIterator iterator(std::move(results), matched_input);
|
||||
return action_(&iterator);
|
||||
}
|
||||
|
||||
Symbol& Symbol::operator=(std::initializer_list<Rule> rules) {
|
||||
rules_.clear();
|
||||
for (const Rule& rule : rules) {
|
||||
AddRule(rule);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
std::vector<const Item*> Item::Children() const {
|
||||
std::vector<const Item*> children;
|
||||
for (const Item* current = this; current->prev_; current = current->prev_) {
|
||||
children.push_back(current->child_);
|
||||
}
|
||||
// The above loop collects the child nodes in reversed order.
|
||||
std::reverse(children.begin(), children.end());
|
||||
DCHECK_EQ(children.size(), right().size());
|
||||
return children;
|
||||
}
|
||||
|
||||
std::string Item::SplitByChildren(const LexerResult& tokens) const {
|
||||
if (right().size() == 1) {
|
||||
if (const Item* child = Children()[0])
|
||||
return child->SplitByChildren(tokens);
|
||||
}
|
||||
std::stringstream s;
|
||||
bool first = true;
|
||||
for (const Item* item : Children()) {
|
||||
if (!item) continue;
|
||||
if (!first) s << " ";
|
||||
s << item->GetMatchedInput(tokens).ToString();
|
||||
first = false;
|
||||
}
|
||||
return s.str();
|
||||
}
|
||||
|
||||
void Item::CheckAmbiguity(const Item& other, const LexerResult& tokens) const {
|
||||
DCHECK(*this == other);
|
||||
if (child_ != other.child_) {
|
||||
std::stringstream s;
|
||||
s << "Ambiguous grammer rules for \""
|
||||
<< child_->GetMatchedInput(tokens).ToString() << "\":\n "
|
||||
<< child_->SplitByChildren(tokens) << "\nvs\n "
|
||||
<< other.child_->SplitByChildren(tokens);
|
||||
ReportError(s.str());
|
||||
}
|
||||
if (prev_ != other.prev_) {
|
||||
std::stringstream s;
|
||||
s << "Ambiguous grammer rules for \"" << GetMatchedInput(tokens).ToString()
|
||||
<< "\":\n " << SplitByChildren(tokens) << " ...\nvs\n "
|
||||
<< other.SplitByChildren(tokens) << " ...";
|
||||
ReportError(s.str());
|
||||
}
|
||||
}
|
||||
|
||||
LexerResult Lexer::RunLexer(const std::string& input) {
|
||||
LexerResult result;
|
||||
InputPosition const begin = input.c_str();
|
||||
InputPosition const end = begin + input.size();
|
||||
InputPosition pos = begin;
|
||||
InputPosition token_start = pos;
|
||||
CurrentSourcePosition::Scope scope(
|
||||
SourcePosition{CurrentSourceFile::Get(), 0, 0});
|
||||
match_whitespace_(&pos);
|
||||
while (pos != end) {
|
||||
UpdateSourcePosition(token_start, pos, &CurrentSourcePosition::Get());
|
||||
token_start = pos;
|
||||
Symbol* symbol = MatchToken(&pos, end);
|
||||
if (!symbol) {
|
||||
ReportError("Lexer Error: unknown token " +
|
||||
StringLiteralQuote(std::string(
|
||||
token_start, token_start + std::min<ptrdiff_t>(
|
||||
end - token_start, 10))));
|
||||
}
|
||||
result.token_symbols.push_back(symbol);
|
||||
result.token_contents.push_back(
|
||||
{token_start, pos, CurrentSourcePosition::Get()});
|
||||
match_whitespace_(&pos);
|
||||
}
|
||||
UpdateSourcePosition(token_start, pos, &CurrentSourcePosition::Get());
|
||||
// Add an additional token position to simplify corner cases.
|
||||
result.token_contents.push_back({pos, pos, CurrentSourcePosition::Get()});
|
||||
return result;
|
||||
}
|
||||
|
||||
Symbol* Lexer::MatchToken(InputPosition* pos, InputPosition end) {
|
||||
InputPosition token_start = *pos;
|
||||
Symbol* symbol = nullptr;
|
||||
// Find longest matching pattern.
|
||||
for (std::pair<const PatternFunction, Symbol>& pair : patterns_) {
|
||||
InputPosition token_end = token_start;
|
||||
PatternFunction matchPattern = pair.first;
|
||||
if (matchPattern(&token_end) && token_end > *pos) {
|
||||
*pos = token_end;
|
||||
symbol = &pair.second;
|
||||
}
|
||||
}
|
||||
// Check if matched pattern coincides with a keyword. Prefer the keyword in
|
||||
// this case.
|
||||
if (*pos != token_start) {
|
||||
auto found_keyword = keywords_.find(std::string(token_start, *pos));
|
||||
if (found_keyword != keywords_.end()) {
|
||||
return &found_keyword->second;
|
||||
}
|
||||
return symbol;
|
||||
}
|
||||
// Now check for a keyword (that doesn't overlap with a pattern).
|
||||
// Iterate from the end to ensure that if one keyword is a prefix of another,
|
||||
// we first try to match the longer one.
|
||||
for (auto it = keywords_.rbegin(); it != keywords_.rend(); ++it) {
|
||||
const std::string& keyword = it->first;
|
||||
if (static_cast<size_t>(end - *pos) < keyword.size()) continue;
|
||||
if (keyword == std::string(*pos, *pos + keyword.size())) {
|
||||
*pos += keyword.size();
|
||||
return &it->second;
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// This is an implementation of Earley's parsing algorithm
|
||||
// (https://en.wikipedia.org/wiki/Earley_parser).
|
||||
const Item* RunEarleyAlgorithm(
|
||||
Symbol* start, const LexerResult& tokens,
|
||||
std::unordered_set<Item, base::hash<Item>>* processed) {
|
||||
// Worklist for items at the current position.
|
||||
std::vector<Item> worklist;
|
||||
// Worklist for items at the next position.
|
||||
std::vector<Item> future_items;
|
||||
CurrentSourcePosition::Scope source_position(
|
||||
SourcePosition{CurrentSourceFile::Get(), 0, 0});
|
||||
std::vector<const Item*> completed_items;
|
||||
std::unordered_map<std::pair<size_t, Symbol*>, std::set<const Item*>,
|
||||
base::hash<std::pair<size_t, Symbol*>>>
|
||||
waiting;
|
||||
|
||||
std::vector<const Item*> debug_trace;
|
||||
|
||||
// Start with one top_level symbol mapping to the start symbol of the grammar.
|
||||
// This simplifies things because the start symbol might have several
|
||||
// rules.
|
||||
Symbol top_level;
|
||||
top_level.AddRule(Rule({start}));
|
||||
worklist.push_back(Item{top_level.rule(0), 0, 0, 0});
|
||||
|
||||
size_t input_length = tokens.token_symbols.size();
|
||||
|
||||
for (size_t pos = 0; pos <= input_length; ++pos) {
|
||||
while (!worklist.empty()) {
|
||||
auto insert_result = processed->insert(worklist.back());
|
||||
const Item& item = *insert_result.first;
|
||||
DCHECK_EQ(pos, item.pos());
|
||||
MatchedInput last_token = tokens.token_contents[pos];
|
||||
CurrentSourcePosition::Get() = last_token.pos;
|
||||
bool is_new = insert_result.second;
|
||||
if (!is_new) item.CheckAmbiguity(worklist.back(), tokens);
|
||||
worklist.pop_back();
|
||||
if (!is_new) continue;
|
||||
|
||||
debug_trace.push_back(&item);
|
||||
if (item.IsComplete()) {
|
||||
// 'Complete' phase: Advance all items that were waiting to match this
|
||||
// symbol next.
|
||||
for (const Item* parent : waiting[{item.start(), item.left()}]) {
|
||||
worklist.push_back(parent->Advance(pos, &item));
|
||||
}
|
||||
} else {
|
||||
Symbol* next = item.NextSymbol();
|
||||
// 'Scan' phase: Check if {next} is the next symbol in the input (this
|
||||
// is never the case if {next} is a non-terminal).
|
||||
if (pos < tokens.token_symbols.size() &&
|
||||
tokens.token_symbols[pos] == next) {
|
||||
future_items.push_back(item.Advance(pos + 1, nullptr));
|
||||
}
|
||||
// 'Predict' phase: Add items for every rule of the non-terminal.
|
||||
if (!next->IsTerminal()) {
|
||||
// Remember that this item is waiting for completion with {next}.
|
||||
waiting[{pos, next}].insert(&item);
|
||||
}
|
||||
for (size_t i = 0; i < next->rule_number(); ++i) {
|
||||
Rule* rule = next->rule(i);
|
||||
auto already_completed =
|
||||
processed->find(Item{rule, rule->right().size(), pos, pos});
|
||||
// As discussed in section 3 of
|
||||
// Aycock, John, and R. Nigel Horspool. "Practical earley
|
||||
// parsing." The Computer Journal 45.6 (2002): 620-630.
|
||||
// Earley parsing has the following problem with epsilon rules:
|
||||
// When we complete an item that started at the current position
|
||||
// (that is, it matched zero tokens), we might not yet have
|
||||
// predicted all items it can complete with. Thus we check for the
|
||||
// existence of such items here and complete them immediately.
|
||||
if (already_completed != processed->end()) {
|
||||
worklist.push_back(item.Advance(pos, &*already_completed));
|
||||
} else {
|
||||
worklist.push_back(Item{rule, 0, pos, pos});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
std::swap(worklist, future_items);
|
||||
}
|
||||
|
||||
auto final_item =
|
||||
processed->find(Item{top_level.rule(0), 1, 0, input_length});
|
||||
if (final_item != processed->end()) {
|
||||
// Success: The {top_level} rule matches the complete input.
|
||||
return final_item->Children()[0];
|
||||
}
|
||||
std::string reason;
|
||||
const Item& last_item = *debug_trace.back();
|
||||
if (last_item.pos() < tokens.token_symbols.size()) {
|
||||
std::string next_token = tokens.token_contents[last_item.pos()].ToString();
|
||||
reason = "unexpected token \"" + next_token + "\"";
|
||||
} else {
|
||||
reason = "unexpected end of input";
|
||||
}
|
||||
ReportError("Parser Error: " + reason);
|
||||
}
|
||||
|
||||
// static
|
||||
bool Grammar::MatchChar(int (*char_class)(int), InputPosition* pos) {
|
||||
if (**pos && char_class(static_cast<unsigned char>(**pos))) {
|
||||
++*pos;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// static
|
||||
bool Grammar::MatchChar(bool (*char_class)(char), InputPosition* pos) {
|
||||
if (**pos && char_class(**pos)) {
|
||||
++*pos;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// static
|
||||
bool Grammar::MatchString(const char* s, InputPosition* pos) {
|
||||
InputPosition current = *pos;
|
||||
for (; *s != 0; ++s, ++current) {
|
||||
if (*s != *current) return false;
|
||||
}
|
||||
*pos = current;
|
||||
return true;
|
||||
}
|
||||
|
||||
// static
|
||||
bool Grammar::MatchAnyChar(InputPosition* pos) {
|
||||
return MatchChar([](char c) { return true; }, pos);
|
||||
}
|
||||
|
||||
} // namespace torque
|
||||
} // namespace internal
|
||||
} // namespace v8
|
471
src/torque/earley-parser.h
Normal file
471
src/torque/earley-parser.h
Normal file
@ -0,0 +1,471 @@
|
||||
// Copyright 2018 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef V8_TORQUE_EARLEY_PARSER_H_
|
||||
#define V8_TORQUE_EARLEY_PARSER_H_
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
#include "src/base/optional.h"
|
||||
#include "src/torque/contextual.h"
|
||||
#include "src/torque/source-positions.h"
|
||||
#include "src/torque/utils.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
namespace torque {
|
||||
|
||||
class Symbol;
|
||||
class Item;
|
||||
|
||||
class ParseResultHolderBase {
|
||||
public:
|
||||
enum class TypeId;
|
||||
virtual ~ParseResultHolderBase() = default;
|
||||
template <class T>
|
||||
T& Cast();
|
||||
template <class T>
|
||||
const T& Cast() const;
|
||||
|
||||
protected:
|
||||
explicit ParseResultHolderBase(TypeId type_id) : type_id_(type_id) {
|
||||
// MSVC wrongly complains about type_id_ being an unused private field.
|
||||
USE(type_id_);
|
||||
}
|
||||
|
||||
private:
|
||||
const TypeId type_id_;
|
||||
};
|
||||
|
||||
using ParseResultTypeId = ParseResultHolderBase::TypeId;
|
||||
|
||||
template <class T>
|
||||
class ParseResultHolder : public ParseResultHolderBase {
|
||||
public:
|
||||
explicit ParseResultHolder(T value)
|
||||
: ParseResultHolderBase(id), value_(std::move(value)) {}
|
||||
|
||||
private:
|
||||
static const TypeId id;
|
||||
friend class ParseResultHolderBase;
|
||||
T value_;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
T& ParseResultHolderBase::Cast() {
|
||||
CHECK_EQ(ParseResultHolder<T>::id, type_id_);
|
||||
return static_cast<ParseResultHolder<T>*>(this)->value_;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
const T& ParseResultHolderBase::Cast() const {
|
||||
CHECK_EQ(ParseResultHolder<T>::id, type_id_);
|
||||
return static_cast<const ParseResultHolder<T>*>(this)->value_;
|
||||
}
|
||||
|
||||
class ParseResult {
|
||||
public:
|
||||
template <class T>
|
||||
explicit ParseResult(T x) : value_(new ParseResultHolder<T>(std::move(x))) {}
|
||||
|
||||
template <class T>
|
||||
const T& Cast() const {
|
||||
return value_->Cast<T>();
|
||||
}
|
||||
template <class T>
|
||||
T& Cast() {
|
||||
return value_->Cast<T>();
|
||||
}
|
||||
|
||||
private:
|
||||
std::unique_ptr<ParseResultHolderBase> value_;
|
||||
};
|
||||
|
||||
using InputPosition = const char*;
|
||||
|
||||
struct MatchedInput {
|
||||
MatchedInput(InputPosition begin, InputPosition end, SourcePosition pos)
|
||||
: begin(begin), end(end), pos(pos) {}
|
||||
InputPosition begin;
|
||||
InputPosition end;
|
||||
SourcePosition pos;
|
||||
std::string ToString() const { return {begin, end}; }
|
||||
};
|
||||
|
||||
class ParseResultIterator {
|
||||
public:
|
||||
explicit ParseResultIterator(std::vector<ParseResult> results,
|
||||
MatchedInput matched_input)
|
||||
: results_(std::move(results)), matched_input_(matched_input) {}
|
||||
~ParseResultIterator() {
|
||||
// Check that all parse results have been used.
|
||||
CHECK_EQ(results_.size(), i_);
|
||||
}
|
||||
|
||||
ParseResult Next() {
|
||||
CHECK_LT(i_, results_.size());
|
||||
return std::move(results_[i_++]);
|
||||
}
|
||||
template <class T>
|
||||
T NextAs() {
|
||||
return std::move(Next().Cast<T>());
|
||||
}
|
||||
bool HasNext() const { return i_ < results_.size(); }
|
||||
|
||||
const MatchedInput& matched_input() const { return matched_input_; }
|
||||
|
||||
private:
|
||||
std::vector<ParseResult> results_;
|
||||
size_t i_ = 0;
|
||||
MatchedInput matched_input_;
|
||||
|
||||
DISALLOW_COPY_AND_MOVE_AND_ASSIGN(ParseResultIterator);
|
||||
};
|
||||
|
||||
struct LexerResult {
|
||||
std::vector<Symbol*> token_symbols;
|
||||
std::vector<MatchedInput> token_contents;
|
||||
};
|
||||
|
||||
using Action =
|
||||
base::Optional<ParseResult> (*)(ParseResultIterator* child_results);
|
||||
|
||||
inline base::Optional<ParseResult> DefaultAction(
|
||||
ParseResultIterator* child_results) {
|
||||
if (!child_results->HasNext()) return base::nullopt;
|
||||
return child_results->Next();
|
||||
}
|
||||
|
||||
// A rule of the context-free grammar. Each rule can have an action attached to
|
||||
// it, which is executed after the parsing is finished.
|
||||
class Rule final {
|
||||
public:
|
||||
explicit Rule(std::vector<Symbol*> right_hand_side,
|
||||
Action action = DefaultAction)
|
||||
: right_hand_side_(std::move(right_hand_side)), action_(action) {}
|
||||
|
||||
Symbol* left() const {
|
||||
DCHECK_NOT_NULL(left_hand_side_);
|
||||
return left_hand_side_;
|
||||
}
|
||||
const std::vector<Symbol*>& right() const { return right_hand_side_; }
|
||||
|
||||
void SetLeftHandSide(Symbol* left_hand_side) {
|
||||
DCHECK_NULL(left_hand_side_);
|
||||
left_hand_side_ = left_hand_side;
|
||||
}
|
||||
|
||||
base::Optional<ParseResult> RunAction(const Item* completed_item,
|
||||
const LexerResult& tokens) const;
|
||||
|
||||
private:
|
||||
Symbol* left_hand_side_ = nullptr;
|
||||
std::vector<Symbol*> right_hand_side_;
|
||||
Action action_;
|
||||
};
|
||||
|
||||
// A Symbol represents a terminal or a non-terminal of the grammar.
|
||||
// It stores the list of rules, which have this symbol as the
|
||||
// left-hand side.
|
||||
// Terminals have an empty list of rules, they are created by the Lexer
|
||||
// instead of from rules.
|
||||
// Symbols need to reside at stable memory addresses, because the addresses are
|
||||
// used in the parser.
|
||||
class Symbol {
|
||||
public:
|
||||
Symbol() : Symbol({}) {}
|
||||
Symbol(std::initializer_list<Rule> rules) { *this = rules; }
|
||||
|
||||
Symbol& operator=(std::initializer_list<Rule> rules);
|
||||
|
||||
bool IsTerminal() const { return rules_.empty(); }
|
||||
Rule* rule(size_t index) const { return rules_[index].get(); }
|
||||
size_t rule_number() const { return rules_.size(); }
|
||||
|
||||
void AddRule(const Rule& rule) {
|
||||
rules_.push_back(base::make_unique<Rule>(rule));
|
||||
rules_.back()->SetLeftHandSide(this);
|
||||
}
|
||||
|
||||
base::Optional<ParseResult> RunAction(const Item* item,
|
||||
const LexerResult& tokens);
|
||||
|
||||
private:
|
||||
std::vector<std::unique_ptr<Rule>> rules_;
|
||||
|
||||
// Disallow copying and moving to ensure Symbol has a stable address.
|
||||
DISALLOW_COPY_AND_MOVE_AND_ASSIGN(Symbol);
|
||||
};
|
||||
|
||||
// Items are the core datastructure of Earley's algorithm.
|
||||
// They consist of a (partially) matched rule, a marked position inside of the
|
||||
// right-hand side of the rule (traditionally written as a dot) and an input
|
||||
// range from {start} to {pos} that matches the symbols of the right-hand side
|
||||
// that are left of the mark. In addition, they store a child and a left-sibling
|
||||
// pointer to reconstruct the AST in the end.
|
||||
class Item {
|
||||
public:
|
||||
Item(const Rule* rule, size_t mark, size_t start, size_t pos)
|
||||
: rule_(rule), mark_(mark), start_(start), pos_(pos) {
|
||||
DCHECK_LE(mark_, right().size());
|
||||
}
|
||||
|
||||
// A complete item has the mark at the right end, which means the input range
|
||||
// matches the complete rule.
|
||||
bool IsComplete() const {
|
||||
DCHECK_LE(mark_, right().size());
|
||||
return mark_ == right().size();
|
||||
}
|
||||
|
||||
// The symbol right after the mark is expected at {pos} for this item to
|
||||
// advance.
|
||||
Symbol* NextSymbol() const {
|
||||
DCHECK(!IsComplete());
|
||||
DCHECK_LT(mark_, right().size());
|
||||
return right()[mark_];
|
||||
}
|
||||
|
||||
// We successfully parsed NextSymbol() between {pos} and {new_pos}.
|
||||
// If NextSymbol() was a non-terminal, then {child} is a pointer to a
|
||||
// completed item for this parse.
|
||||
// We create a new item, which moves the mark one forward.
|
||||
Item Advance(size_t new_pos, const Item* child = nullptr) const {
|
||||
if (child) {
|
||||
DCHECK(child->IsComplete());
|
||||
DCHECK_EQ(pos(), child->start());
|
||||
DCHECK_EQ(new_pos, child->pos());
|
||||
DCHECK_EQ(NextSymbol(), child->left());
|
||||
}
|
||||
Item result(rule_, mark_ + 1, start_, new_pos);
|
||||
result.prev_ = this;
|
||||
result.child_ = child;
|
||||
return result;
|
||||
}
|
||||
|
||||
// Collect the items representing the AST children of this completed item.
|
||||
std::vector<const Item*> Children() const;
|
||||
// The matched input separated according to the next branching AST level.
|
||||
std::string SplitByChildren(const LexerResult& tokens) const;
|
||||
// Check if {other} results in the same AST as this Item.
|
||||
void CheckAmbiguity(const Item& other, const LexerResult& tokens) const;
|
||||
|
||||
MatchedInput GetMatchedInput(const LexerResult& tokens) const {
|
||||
return {tokens.token_contents[start_].begin,
|
||||
start_ == pos_ ? tokens.token_contents[start_].begin
|
||||
: tokens.token_contents[pos_ - 1].end,
|
||||
tokens.token_contents[start_].pos};
|
||||
}
|
||||
|
||||
// We exclude {prev_} and {child_} from equality and hash computations,
|
||||
// because they are just globally unique data associated with an item.
|
||||
bool operator==(const Item& other) const {
|
||||
return rule_ == other.rule_ && mark_ == other.mark_ &&
|
||||
start_ == other.start_ && pos_ == other.pos_;
|
||||
}
|
||||
|
||||
friend size_t hash_value(const Item& i) {
|
||||
return base::hash_combine(i.rule_, i.mark_, i.start_, i.pos_);
|
||||
}
|
||||
|
||||
const Rule* rule() const { return rule_; }
|
||||
Symbol* left() const { return rule_->left(); }
|
||||
const std::vector<Symbol*>& right() const { return rule_->right(); }
|
||||
size_t pos() const { return pos_; }
|
||||
size_t start() const { return start_; }
|
||||
|
||||
private:
|
||||
const Rule* rule_;
|
||||
size_t mark_;
|
||||
size_t start_;
|
||||
size_t pos_;
|
||||
|
||||
const Item* prev_ = nullptr;
|
||||
const Item* child_ = nullptr;
|
||||
};
|
||||
|
||||
inline base::Optional<ParseResult> Symbol::RunAction(
|
||||
const Item* item, const LexerResult& tokens) {
|
||||
DCHECK(item->IsComplete());
|
||||
DCHECK_EQ(item->left(), this);
|
||||
return item->rule()->RunAction(item, tokens);
|
||||
}
|
||||
|
||||
const Item* RunEarleyAlgorithm(
|
||||
Symbol* start, const LexerResult& tokens,
|
||||
std::unordered_set<Item, base::hash<Item>>* processed);
|
||||
|
||||
inline base::Optional<ParseResult> ParseTokens(Symbol* start,
|
||||
const LexerResult& tokens) {
|
||||
std::unordered_set<Item, base::hash<Item>> table;
|
||||
const Item* final_item = RunEarleyAlgorithm(start, tokens, &table);
|
||||
return start->RunAction(final_item, tokens);
|
||||
}
|
||||
|
||||
// The lexical syntax is dynamically defined while building the grammar by
|
||||
// adding patterns and keywords to the Lexer.
|
||||
// The term keyword here can stand for any fixed character sequence, including
|
||||
// operators and parentheses.
|
||||
// Each pattern or keyword automatically gets a terminal symbol associated with
|
||||
// it. These symbols form the result of the lexing.
|
||||
// Patterns and keywords are matched using the longest match principle. If the
|
||||
// longest matching pattern coincides with a keyword, the keyword symbol is
|
||||
// chosen instead of the pattern.
|
||||
// In addition, there is a single whitespace pattern which is consumed but does
|
||||
// not become part of the token list.
|
||||
class Lexer {
|
||||
public:
|
||||
// Functions to define patterns. They try to match starting from {pos}. If
|
||||
// successful, they return true and advance {pos}. Otherwise, {pos} stays
|
||||
// unchanged.
|
||||
using PatternFunction = bool (*)(InputPosition* pos);
|
||||
|
||||
void SetWhitespace(PatternFunction whitespace) {
|
||||
match_whitespace_ = whitespace;
|
||||
}
|
||||
|
||||
Symbol* Pattern(PatternFunction pattern) { return &patterns_[pattern]; }
|
||||
Symbol* Token(const std::string& keyword) { return &keywords_[keyword]; }
|
||||
LexerResult RunLexer(const std::string& input);
|
||||
|
||||
private:
|
||||
PatternFunction match_whitespace_ = [](InputPosition*) { return false; };
|
||||
std::map<PatternFunction, Symbol> patterns_;
|
||||
std::map<std::string, Symbol> keywords_;
|
||||
Symbol* MatchToken(InputPosition* pos, InputPosition end);
|
||||
};
|
||||
|
||||
// A grammar can have a result, which is the results of the start symbol.
|
||||
// Grammar is intended to be subclassed, with Symbol members forming the
|
||||
// mutually recursive rules of the grammar.
|
||||
class Grammar {
|
||||
public:
|
||||
using PatternFunction = Lexer::PatternFunction;
|
||||
|
||||
explicit Grammar(Symbol* start) : start_(start) {}
|
||||
|
||||
base::Optional<ParseResult> Parse(const std::string& input) {
|
||||
LexerResult tokens = lexer().RunLexer(input);
|
||||
return ParseTokens(start_, tokens);
|
||||
}
|
||||
|
||||
protected:
|
||||
Symbol* Token(const std::string& s) { return lexer_.Token(s); }
|
||||
Symbol* Pattern(PatternFunction pattern) { return lexer_.Pattern(pattern); }
|
||||
void SetWhitespace(PatternFunction ws) { lexer_.SetWhitespace(ws); }
|
||||
|
||||
// NewSymbol() allocates a fresh symbol and stores it in the current grammar.
|
||||
// This is necessary to define helpers that create new symbols.
|
||||
Symbol* NewSymbol(std::initializer_list<Rule> rules = {}) {
|
||||
Symbol* result = new Symbol(rules);
|
||||
generated_symbols_.push_back(std::unique_ptr<Symbol>(result));
|
||||
return result;
|
||||
}
|
||||
|
||||
// Helper functions to define lexer patterns. If they match, they return true
|
||||
// and advance {pos}. Otherwise, {pos} is unchanged.
|
||||
static bool MatchChar(int (*char_class)(int), InputPosition* pos);
|
||||
static bool MatchChar(bool (*char_class)(char), InputPosition* pos);
|
||||
static bool MatchAnyChar(InputPosition* pos);
|
||||
static bool MatchString(const char* s, InputPosition* pos);
|
||||
|
||||
// The action MatchInput() produces the input matched by the rule as
|
||||
// result.
|
||||
static base::Optional<ParseResult> YieldMatchedInput(
|
||||
ParseResultIterator* child_results) {
|
||||
return ParseResult{child_results->matched_input().ToString()};
|
||||
}
|
||||
|
||||
// Create a new symbol to parse the given sequence of symbols.
|
||||
// At most one of the symbols can return a result.
|
||||
Symbol* Sequence(std::vector<Symbol*> symbols) {
|
||||
return NewSymbol({Rule(std::move(symbols))});
|
||||
}
|
||||
|
||||
template <class T, T value>
|
||||
static base::Optional<ParseResult> YieldIntegralConstant(
|
||||
ParseResultIterator* child_results) {
|
||||
return ParseResult{value};
|
||||
}
|
||||
|
||||
template <class T>
|
||||
static base::Optional<ParseResult> YieldDefaultValue(
|
||||
ParseResultIterator* child_results) {
|
||||
return ParseResult{T{}};
|
||||
}
|
||||
|
||||
template <class From, class To>
|
||||
static base::Optional<ParseResult> CastParseResult(
|
||||
ParseResultIterator* child_results) {
|
||||
To result = std::move(child_results->NextAs<From>());
|
||||
return ParseResult{std::move(result)};
|
||||
}
|
||||
|
||||
// Try to parse {s} and return the result of type {Result} casted to {T}.
|
||||
// Otherwise, the result is a default-constructed {T}.
|
||||
template <class T, class Result = T>
|
||||
Symbol* TryOrDefault(Symbol* s) {
|
||||
return NewSymbol({Rule({s}, CastParseResult<Result, T>),
|
||||
Rule({}, YieldDefaultValue<T>)});
|
||||
}
|
||||
|
||||
template <class T>
|
||||
static base::Optional<ParseResult> MakeSingletonVector(
|
||||
ParseResultIterator* child_results) {
|
||||
T x = child_results->NextAs<T>();
|
||||
std::vector<T> result;
|
||||
result.push_back(std::move(x));
|
||||
return ParseResult{std::move(result)};
|
||||
}
|
||||
|
||||
template <class T>
|
||||
static base::Optional<ParseResult> MakeExtendedVector(
|
||||
ParseResultIterator* child_results) {
|
||||
std::vector<T> l = child_results->NextAs<std::vector<T>>();
|
||||
T x = child_results->NextAs<T>();
|
||||
l.push_back(std::move(x));
|
||||
return ParseResult{std::move(l)};
|
||||
}
|
||||
|
||||
// For example, NonemptyList(Token("A"), Token(",")) parses any of
|
||||
// A or A,A or A,A,A and so on.
|
||||
template <class T>
|
||||
Symbol* NonemptyList(Symbol* element,
|
||||
base::Optional<Symbol*> separator = {}) {
|
||||
Symbol* list = NewSymbol();
|
||||
*list = {Rule({element}, MakeSingletonVector<T>),
|
||||
separator
|
||||
? Rule({list, *separator, element}, MakeExtendedVector<T>)
|
||||
: Rule({list, element}, MakeExtendedVector<T>)};
|
||||
return list;
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Symbol* List(Symbol* element, base::Optional<Symbol*> separator = {}) {
|
||||
return TryOrDefault<std::vector<T>>(NonemptyList<T>(element, separator));
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Symbol* Optional(Symbol* x) {
|
||||
return TryOrDefault<base::Optional<T>, T>(x);
|
||||
}
|
||||
|
||||
Symbol* CheckIf(Symbol* x) {
|
||||
return NewSymbol({Rule({x}, YieldIntegralConstant<bool, true>),
|
||||
Rule({}, YieldIntegralConstant<bool, false>)});
|
||||
}
|
||||
|
||||
Lexer& lexer() { return lexer_; }
|
||||
|
||||
private:
|
||||
Lexer lexer_;
|
||||
std::vector<std::unique_ptr<Symbol>> generated_symbols_;
|
||||
Symbol* start_;
|
||||
};
|
||||
|
||||
} // namespace torque
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
||||
#endif // V8_TORQUE_EARLEY_PARSER_H_
|
@ -13,8 +13,6 @@
|
||||
#include "src/torque/types.h"
|
||||
#include "src/torque/utils.h"
|
||||
|
||||
#include "src/torque/TorqueBaseVisitor.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
namespace torque {
|
||||
|
@ -5,8 +5,6 @@
|
||||
#ifndef V8_TORQUE_GLOBAL_CONTEXT_H_
|
||||
#define V8_TORQUE_GLOBAL_CONTEXT_H_
|
||||
|
||||
#include "src/torque/TorqueLexer.h"
|
||||
#include "src/torque/TorqueParser.h"
|
||||
#include "src/torque/declarable.h"
|
||||
#include "src/torque/declarations.h"
|
||||
#include "src/torque/scope.h"
|
||||
@ -38,15 +36,6 @@ class Module {
|
||||
std::stringstream source_stream_;
|
||||
};
|
||||
|
||||
struct SourceFileContext {
|
||||
std::string name;
|
||||
std::unique_ptr<antlr4::ANTLRFileStream> stream;
|
||||
std::unique_ptr<TorqueLexer> lexer;
|
||||
std::unique_ptr<antlr4::CommonTokenStream> tokens;
|
||||
std::unique_ptr<TorqueParser> parser;
|
||||
TorqueParser::FileContext* file;
|
||||
};
|
||||
|
||||
class GlobalContext {
|
||||
public:
|
||||
explicit GlobalContext(Ast ast)
|
||||
|
@ -115,9 +115,6 @@ class ImplementationVisitor : public FileVisitor {
|
||||
VisitResult Visit(LogicalOrExpression* expr);
|
||||
VisitResult Visit(LogicalAndExpression* expr);
|
||||
|
||||
LocationReference GetLocationReference(
|
||||
TorqueParser::LocationExpressionContext* locationExpression);
|
||||
|
||||
VisitResult Visit(IncrementDecrementExpression* expr);
|
||||
VisitResult Visit(AssignmentExpression* expr);
|
||||
VisitResult Visit(StringLiteralExpression* expr);
|
||||
|
@ -5,9 +5,9 @@
|
||||
#ifndef V8_TORQUE_SCOPE_H_
|
||||
#define V8_TORQUE_SCOPE_H_
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "./antlr4-runtime.h"
|
||||
#include "src/torque/ast.h"
|
||||
#include "src/torque/types.h"
|
||||
#include "src/torque/utils.h"
|
||||
|
55
src/torque/source-positions.h
Normal file
55
src/torque/source-positions.h
Normal file
@ -0,0 +1,55 @@
|
||||
// Copyright 2018 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef V8_TORQUE_SOURCE_POSITIONS_H_
|
||||
#define V8_TORQUE_SOURCE_POSITIONS_H_
|
||||
|
||||
#include "src/torque/contextual.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
namespace torque {
|
||||
|
||||
class SourceId {
|
||||
private:
|
||||
explicit SourceId(int id) : id_(id) {}
|
||||
int id_;
|
||||
friend class SourceFileMap;
|
||||
};
|
||||
|
||||
struct SourcePosition {
|
||||
SourceId source;
|
||||
int line;
|
||||
int column;
|
||||
};
|
||||
|
||||
DECLARE_CONTEXTUAL_VARIABLE(CurrentSourceFile, SourceId)
|
||||
DECLARE_CONTEXTUAL_VARIABLE(CurrentSourcePosition, SourcePosition)
|
||||
|
||||
class SourceFileMap : public ContextualClass<SourceFileMap> {
|
||||
public:
|
||||
SourceFileMap() {}
|
||||
static const std::string& GetSource(SourceId source) {
|
||||
return Get().sources_[source.id_];
|
||||
}
|
||||
|
||||
static SourceId AddSource(std::string path) {
|
||||
Get().sources_.push_back(std::move(path));
|
||||
return SourceId(static_cast<int>(Get().sources_.size()) - 1);
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<std::string> sources_;
|
||||
};
|
||||
|
||||
inline std::string PositionAsString(SourcePosition pos) {
|
||||
return SourceFileMap::GetSource(pos.source) + ":" +
|
||||
std::to_string(pos.line + 1) + ":" + std::to_string(pos.column + 1);
|
||||
}
|
||||
|
||||
} // namespace torque
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
||||
#endif // V8_TORQUE_SOURCE_POSITIONS_H_
|
1135
src/torque/torque-parser.cc
Normal file
1135
src/torque/torque-parser.cc
Normal file
File diff suppressed because it is too large
Load Diff
23
src/torque/torque-parser.h
Normal file
23
src/torque/torque-parser.h
Normal file
@ -0,0 +1,23 @@
|
||||
// Copyright 2018 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef V8_TORQUE_TORQUE_PARSER_H_
|
||||
#define V8_TORQUE_TORQUE_PARSER_H_
|
||||
|
||||
#include "src/torque/ast.h"
|
||||
|
||||
namespace v8 {
|
||||
namespace internal {
|
||||
namespace torque {
|
||||
|
||||
DECLARE_CONTEXTUAL_VARIABLE(CurrentAst, Ast);
|
||||
|
||||
// Adds the parsed input to {CurrentAst}
|
||||
void ParseTorque(const std::string& input);
|
||||
|
||||
} // namespace torque
|
||||
} // namespace internal
|
||||
} // namespace v8
|
||||
|
||||
#endif // V8_TORQUE_TORQUE_PARSER_H_
|
@ -2,17 +2,15 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
#include "./antlr4-runtime.h"
|
||||
#include "src/torque/TorqueBaseVisitor.h"
|
||||
#include "src/torque/TorqueLexer.h"
|
||||
#include "src/torque/ast-generator.h"
|
||||
#include "src/torque/declarable.h"
|
||||
#include "src/torque/declaration-visitor.h"
|
||||
#include "src/torque/global-context.h"
|
||||
#include "src/torque/implementation-visitor.h"
|
||||
#include "src/torque/scope.h"
|
||||
#include "src/torque/torque-parser.h"
|
||||
#include "src/torque/type-oracle.h"
|
||||
#include "src/torque/types.h"
|
||||
#include "src/torque/utils.h"
|
||||
@ -23,44 +21,13 @@ namespace torque {
|
||||
|
||||
size_t Label::next_id_ = 0;
|
||||
|
||||
class FailedParseErrorStrategy : public antlr4::DefaultErrorStrategy {
|
||||
public:
|
||||
FailedParseErrorStrategy() : DefaultErrorStrategy(), failed_(false) {}
|
||||
void reportError(antlr4::Parser* recognizer,
|
||||
const antlr4::RecognitionException& e) override {
|
||||
antlr4::DefaultErrorStrategy::reportError(recognizer, e);
|
||||
failed_ = true;
|
||||
}
|
||||
|
||||
bool FailedParse() const { return failed_; }
|
||||
|
||||
public:
|
||||
bool failed_;
|
||||
};
|
||||
|
||||
class TorqueErrorListener : public antlr4::BaseErrorListener {
|
||||
public:
|
||||
TorqueErrorListener() : BaseErrorListener() {}
|
||||
|
||||
void syntaxError(antlr4::Recognizer* recognizer,
|
||||
antlr4::Token* /*offendingSymbol*/, size_t line,
|
||||
size_t charPositionInLine, const std::string& msg,
|
||||
std::exception_ptr /*e*/) {
|
||||
std::cerr << recognizer->getInputStream()->getSourceName() << ": " << line
|
||||
<< ":" << charPositionInLine << " " << msg << "\n";
|
||||
}
|
||||
};
|
||||
|
||||
int WrappedMain(int argc, const char** argv) {
|
||||
std::string output_directory;
|
||||
std::vector<SourceFileContext> file_contexts;
|
||||
AstGenerator ast_generator;
|
||||
SourceFileContext context;
|
||||
size_t lexer_errors = 0;
|
||||
auto error_strategy = std::make_shared<FailedParseErrorStrategy>();
|
||||
TorqueErrorListener error_listener;
|
||||
bool verbose = false;
|
||||
SourceFileMap::Scope scope;
|
||||
SourceFileMap::Scope source_file_map_scope;
|
||||
CurrentSourceFile::Scope unknown_sourcefile_scope(
|
||||
SourceFileMap::AddSource("<unknown>"));
|
||||
CurrentAst::Scope ast_scope;
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
// Check for options
|
||||
if (!strcmp("-o", argv[i])) {
|
||||
@ -75,31 +42,16 @@ int WrappedMain(int argc, const char** argv) {
|
||||
// Otherwise it's a .tq
|
||||
// file, parse it and
|
||||
// remember the syntax tree
|
||||
context.name = argv[i];
|
||||
context.stream = std::unique_ptr<antlr4::ANTLRFileStream>(
|
||||
new antlr4::ANTLRFileStream(context.name.c_str()));
|
||||
context.lexer =
|
||||
std::unique_ptr<TorqueLexer>(new TorqueLexer(context.stream.get()));
|
||||
context.lexer->removeErrorListeners();
|
||||
context.lexer->addErrorListener(&error_listener);
|
||||
context.tokens = std::unique_ptr<antlr4::CommonTokenStream>(
|
||||
new antlr4::CommonTokenStream(context.lexer.get()));
|
||||
context.tokens->fill();
|
||||
lexer_errors += context.lexer->getNumberOfSyntaxErrors();
|
||||
context.parser =
|
||||
std::unique_ptr<TorqueParser>(new TorqueParser(context.tokens.get()));
|
||||
context.parser->setErrorHandler(error_strategy);
|
||||
context.parser->removeErrorListeners();
|
||||
context.parser->addErrorListener(&error_listener);
|
||||
context.file = context.parser->file();
|
||||
ast_generator.visitSourceFile(&context);
|
||||
std::string path = argv[i];
|
||||
SourceId source_id = SourceFileMap::AddSource(path);
|
||||
CurrentSourceFile::Scope source_id_scope(source_id);
|
||||
std::ifstream file_stream(path);
|
||||
std::string file_content = {std::istreambuf_iterator<char>(file_stream),
|
||||
std::istreambuf_iterator<char>()};
|
||||
ParseTorque(file_content);
|
||||
}
|
||||
|
||||
if (lexer_errors != 0 || error_strategy->FailedParse()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
GlobalContext global_context(std::move(ast_generator).GetAst());
|
||||
GlobalContext global_context(std::move(CurrentAst::Get()));
|
||||
if (verbose) global_context.SetVerbose();
|
||||
TypeOracle::Scope type_oracle(global_context.declarations());
|
||||
|
||||
|
@ -2,7 +2,6 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
#include "src/torque/declarable.h"
|
||||
|
@ -14,13 +14,71 @@ namespace v8 {
|
||||
namespace internal {
|
||||
namespace torque {
|
||||
|
||||
std::string StringLiteralUnquote(const std::string& s) {
|
||||
DCHECK(('"' == s.front() && '"' == s.back()) ||
|
||||
('\'' == s.front() && '\'' == s.back()));
|
||||
std::stringstream result;
|
||||
for (size_t i = 1; i < s.length() - 1; ++i) {
|
||||
if (s[i] == '\\') {
|
||||
switch (s[++i]) {
|
||||
case 'n':
|
||||
result << '\n';
|
||||
break;
|
||||
case 'r':
|
||||
result << '\r';
|
||||
break;
|
||||
case 't':
|
||||
result << '\t';
|
||||
break;
|
||||
case '\'':
|
||||
case '"':
|
||||
case '\\':
|
||||
result << s[i];
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
}
|
||||
} else {
|
||||
result << s[i];
|
||||
}
|
||||
}
|
||||
return result.str();
|
||||
}
|
||||
|
||||
std::string StringLiteralQuote(const std::string& s) {
|
||||
std::stringstream result;
|
||||
result << '"';
|
||||
for (size_t i = 0; i < s.length() - 1; ++i) {
|
||||
switch (s[i]) {
|
||||
case '\n':
|
||||
result << "\\n";
|
||||
break;
|
||||
case '\r':
|
||||
result << "\\r";
|
||||
break;
|
||||
case '\t':
|
||||
result << "\\t";
|
||||
break;
|
||||
case '\'':
|
||||
case '"':
|
||||
case '\\':
|
||||
result << "\\" << s[i];
|
||||
break;
|
||||
default:
|
||||
result << s[i];
|
||||
}
|
||||
}
|
||||
result << '"';
|
||||
return result.str();
|
||||
}
|
||||
|
||||
std::string CurrentPositionAsString() {
|
||||
return PositionAsString(CurrentSourcePosition::Get());
|
||||
}
|
||||
|
||||
[[noreturn]] void ReportError(const std::string& error) {
|
||||
std::cerr << CurrentPositionAsString() << ": Torque error: " << error << "\n";
|
||||
throw(-1);
|
||||
std::abort();
|
||||
}
|
||||
|
||||
std::string CamelifyString(const std::string& underscore_string) {
|
||||
|
@ -17,6 +17,9 @@ namespace torque {
|
||||
|
||||
typedef std::vector<std::string> NameVector;
|
||||
|
||||
std::string StringLiteralUnquote(const std::string& s);
|
||||
std::string StringLiteralQuote(const std::string& s);
|
||||
|
||||
[[noreturn]] void ReportError(const std::string& error);
|
||||
|
||||
std::string CamelifyString(const std::string& underscore_string);
|
||||
|
Loading…
Reference in New Issue
Block a user