FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
codeql/python/extractor/lark/grammar.py at codeql-cli/v2.26.3 · github/codeql · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
github
/
codeql
Public
Notifications
You must be signed in to change notification settings
Fork
2.1k
Star
10k
Code
Issues
998
Pull requests
464
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
codeql
/
python
/
extractor
/
lark
/
grammar.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
60 lines (45 loc) · 1.52 KB
Breadcrumbs
codeql
/
python
/
extractor
/
lark
/
grammar.py
Copy path
File metadata and controls
60 lines (45 loc) · 1.52 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
class
Symbol
(
object
):
is_term
=
NotImplemented
def
__init__
(
self
,
name
):
self
.
name
=
name
def
__eq__
(
self
,
other
):
assert
isinstance
(
other
,
Symbol
),
other
return
self
.
is_term
==
other
.
is_term
and
self
.
name
==
other
.
name
def
__ne__
(
self
,
other
):
return
not
(
self
==
other
)
def
__hash__
(
self
):
return
hash
(
self
.
name
)
def
__repr__
(
self
):
return
'%s(%r)'
%
(
type
(
self
).
__name__
,
self
.
name
)
class
Terminal
(
Symbol
):
is_term
=
True
def
__init__
(
self
,
name
,
filter_out
=
False
):
self
.
name
=
name
self
.
filter_out
=
filter_out
class
NonTerminal
(
Symbol
):
is_term
=
False
class
Rule
(
object
):
"""
origin : a symbol
expansion : a list of symbols
"""
def
__init__
(
self
,
origin
,
expansion
,
alias
=
None
,
options
=
None
):
self
.
origin
=
origin
self
.
expansion
=
expansion
self
.
alias
=
alias
self
.
options
=
options
def
__str__
(
self
):
return
'<%s : %s>'
%
(
self
.
origin
,
' '
.
join
(
map
(
str
,
self
.
expansion
)))
def
__repr__
(
self
):
return
'Rule(%r, %r, %r, %r)'
%
(
self
.
origin
,
self
.
expansion
,
self
.
alias
,
self
.
options
)
class
RuleOptions
:
def
__init__
(
self
,
keep_all_tokens
=
False
,
expand1
=
False
,
priority
=
None
):
self
.
keep_all_tokens
=
keep_all_tokens
self
.
expand1
=
expand1
self
.
priority
=
priority
def
__repr__
(
self
):
return
'RuleOptions(%r, %r, %r)'
%
(
self
.
keep_all_tokens
,
self
.
expand1
,
self
.
priority
,
)
Back
|
FazBrowse Home
|
New Git URL