Skip to content

Commit 2292146

Browse files
committed
php lexer & php parser
1 parent 146b876 commit 2292146

12 files changed

+11529
-0
lines changed

phpg/PHPLexer.cpp

Lines changed: 693 additions & 0 deletions
Large diffs are not rendered by default.

phpg/PHPLexer.h

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
2+
// Generated from PHPLexer.g4 by ANTLR 4.7.1
3+
4+
#pragma once
5+
6+
7+
#include "antlr4-runtime.h"
8+
9+
10+
11+
12+
class PHPLexer : public antlr4::Lexer {
13+
public:
14+
enum {
15+
PHPStart = 1, PHPO = 2, Html = 3, HtmlWS = 4, PHPEnd = 5, MultiLineComment = 6,
16+
SinglelineComment = 7, UnixComment = 8, RealE = 9, As = 10, SemiColon = 11,
17+
Instanceof = 12, And = 13, List = 14, Const = 15, Or = 16, Xor = 17,
18+
Global = 18, Continue = 19, Return = 20, Implements = 21, Var = 22,
19+
Class = 23, Extends = 24, Do = 25, Switch = 26, Case = 27, Default = 28,
20+
Function = 29, Break = 30, If = 31, Else = 32, ElseIf = 33, For = 34,
21+
Foreach = 35, While = 36, Equals = 37, New = 38, Clone = 39, Ampersand = 40,
22+
Pipe = 41, Bang = 42, Plus = 43, Minus = 44, Asterisk = 45, Percent = 46,
23+
Forwardslash = 47, Tilde = 48, InstanceMember = 49, SuppressWarnings = 50,
24+
Dollar = 51, Dot = 52, ArrayAssign = 53, LogicalOr = 54, LogicalAnd = 55,
25+
ClassMember = 56, QuestionMark = 57, OpenRoundBracket = 58, CloseRoundBracket = 59,
26+
OpenSquareBracket = 60, CloseSquareBracket = 61, OpenCurlyBracket = 62,
27+
CloseCurlyBracket = 63, Interface = 64, Comma = 65, Colon = 66, Abstract = 67,
28+
Static = 68, Array = 69, RequireOperator = 70, PrimitiveType = 71, AccessModifier = 72,
29+
DecimalNumber = 73, HexNumber = 74, OctalNumber = 75, Float = 76, Digits = 77,
30+
Boolean = 78, SingleQuotedString = 79, EscapeCharacter = 80, DoubleQuotedString = 81,
31+
Identifier = 82, AssignmentOperator = 83, EqualityOperator = 84, ComparisionOperator = 85,
32+
ShiftOperator = 86, IncrementOperator = 87, WS = 88
33+
};
34+
35+
enum {
36+
PHPMode = 1
37+
};
38+
39+
PHPLexer(antlr4::CharStream *input);
40+
~PHPLexer();
41+
42+
virtual std::string getGrammarFileName() const override;
43+
virtual const std::vector<std::string>& getRuleNames() const override;
44+
45+
virtual const std::vector<std::string>& getChannelNames() const override;
46+
virtual const std::vector<std::string>& getModeNames() const override;
47+
virtual const std::vector<std::string>& getTokenNames() const override; // deprecated, use vocabulary instead
48+
virtual antlr4::dfa::Vocabulary& getVocabulary() const override;
49+
50+
virtual const std::vector<uint16_t> getSerializedATN() const override;
51+
virtual const antlr4::atn::ATN& getATN() const override;
52+
53+
private:
54+
static std::vector<antlr4::dfa::DFA> _decisionToDFA;
55+
static antlr4::atn::PredictionContextCache _sharedContextCache;
56+
static std::vector<std::string> _ruleNames;
57+
static std::vector<std::string> _tokenNames;
58+
static std::vector<std::string> _channelNames;
59+
static std::vector<std::string> _modeNames;
60+
61+
static std::vector<std::string> _literalNames;
62+
static std::vector<std::string> _symbolicNames;
63+
static antlr4::dfa::Vocabulary _vocabulary;
64+
static antlr4::atn::ATN _atn;
65+
static std::vector<uint16_t> _serializedATN;
66+
67+
68+
// Individual action functions triggered by action() above.
69+
70+
// Individual semantic predicate functions triggered by sempred() above.
71+
72+
struct Initializer {
73+
Initializer();
74+
};
75+
static Initializer _init;
76+
};
77+

0 commit comments

Comments
 (0)