FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
codeql/docs/codeql/qllexer.py at codeql-cli/latest · 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
460
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
/
docs
/
codeql
/
qllexer.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
52 lines (45 loc) · 1.91 KB
Breadcrumbs
codeql
/
docs
/
codeql
/
qllexer.py
Copy path
File metadata and controls
52 lines (45 loc) · 1.91 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
"""
Custom Pygments lexer for highlighting QL code.
Based on instructions from http://pygments.org/docs/lexerdevelopment/.
"""
import
re
from
pygments
.
lexer
import
RegexLexer
,
words
from
pygments
.
token
import
Operator
,
Punctuation
,
Keyword
,
Comment
, \
Name
,
Number
,
String
,
Text
class
QLLexer
(
RegexLexer
):
name
=
'QL'
aliases
=
[
'ql'
]
filenames
=
[
'*.ql'
,
'*.qll'
]
mimetype
=
[
'text/x-ql'
]
flags
=
re
.
MULTILINE
tokens
=
{
'root'
: [
(
r'\r\n|\r|\n'
,
Text
),
(
r'\s+'
,
Text
),
(
r'\"([^\\\"\n\r\t]|\\[\"nrt\\])*\"'
,
String
),
(
r'[0-9]+(\.[0-9])?'
,
Number
),
(
r'[,;.()\[\]{}]'
,
Punctuation
),
# Comments (one-line, multiline, and QLDoc)
(
r'\/\/.*$'
,
Comment
.
Single
),
(
r'\/\*([^\*][\s\S]*?)?\*\/'
,
Comment
.
Multiline
),
(
r'\/\*(?!\*\/)\*[\s\S]*?\*\/'
,
Comment
.
Preproc
),
# Operators
(
r'<=|>=|!=|\.\.|::|[<>=\-\/*%+|]'
,
Operator
),
# Keywords
(
r'\b(boolean|date|float|int|string)\b'
,
Keyword
.
Type
),
(
r'\b(abstract|cached|deprecated|external|final|library|override|private|query'
r'|(pragma|language|bindingset|overlay)\[\w*\??(,\s*\w*\??)*\])\s'
,
Keyword
.
Reserved
),
(
words
((
'and'
,
'any'
,
'as'
,
'asc'
,
'avg'
,
'by'
,
'class'
,
'concat'
,
'count'
,
'desc'
,
'else'
,
'exists'
,
'extends'
,
'false'
,
'forall'
,
'forex'
,
'from'
,
'if'
,
'implies'
,
'import'
,
'in'
,
'instanceof'
,
'max'
,
'min'
,
'module'
,
'newtype'
,
'not'
,
'none'
,
'or'
,
'order'
,
'predicate'
,
'rank'
,
'result'
,
'select'
,
'strictconcat'
,
'strictcount'
,
'strictsum'
,
'sum'
,
'super'
,
'then'
,
'this'
,
'true'
,
'unique'
,
'where'
),
prefix
=
r'\b'
,
suffix
=
r'\b'
),
Keyword
),
# Identifiers
(
r'@?\w'
,
Name
),
]
}
Back
|
FazBrowse Home
|
New Git URL