| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Pegex::Grammar::Atoms; |
|
2
|
10
|
|
|
10
|
|
58
|
use Pegex::Base; |
|
|
10
|
|
|
|
|
18
|
|
|
|
10
|
|
|
|
|
50
|
|
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
#------------------------------------------------------------------------------# |
|
5
|
|
|
|
|
|
|
# Pegex regex atoms for grammars |
|
6
|
|
|
|
|
|
|
#------------------------------------------------------------------------------# |
|
7
|
|
|
|
|
|
|
my $atoms = { |
|
8
|
|
|
|
|
|
|
# Default whitespace rules for that use '~' |
|
9
|
|
|
|
|
|
|
ws => '', |
|
10
|
|
|
|
|
|
|
ws1 => '*', |
|
11
|
|
|
|
|
|
|
ws2 => '+', |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# Default whitespace rules for that use '-' and '+' |
|
14
|
|
|
|
|
|
|
_ => '', |
|
15
|
|
|
|
|
|
|
__ => '', |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# Special rules |
|
18
|
|
|
|
|
|
|
ALWAYS => '', |
|
19
|
|
|
|
|
|
|
NEVER => '(?!)', |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Basics |
|
22
|
|
|
|
|
|
|
ALL => '[\s\S]', # Every char (including newline and space) |
|
23
|
|
|
|
|
|
|
ANY => '.', # Any char (except newline) |
|
24
|
|
|
|
|
|
|
SPACE => '\ ', # ASCII space char |
|
25
|
|
|
|
|
|
|
TAB => '\t', # Horizontal tab |
|
26
|
|
|
|
|
|
|
WS => '\s', # Whitespace |
|
27
|
|
|
|
|
|
|
NS => '\S', # Not Space |
|
28
|
|
|
|
|
|
|
NL => '\n', # Newline |
|
29
|
|
|
|
|
|
|
BREAK => '\n', # Line break (more readable alias for NL) |
|
30
|
|
|
|
|
|
|
CR => '\r', # Carriage return |
|
31
|
|
|
|
|
|
|
EOL => '\r?\n', # Unix/DOS line ending |
|
32
|
|
|
|
|
|
|
DOS => '\r\n', # Windows/DOS line ending |
|
33
|
|
|
|
|
|
|
EOS => '\z', # End of stream/string/file |
|
34
|
|
|
|
|
|
|
EMPTY => '', # Empty string |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
# Common character classes |
|
37
|
|
|
|
|
|
|
WORD => '\w', |
|
38
|
|
|
|
|
|
|
BLANK => '[\ \t]', |
|
39
|
|
|
|
|
|
|
ALPHA => '[a-zA-Z]', |
|
40
|
|
|
|
|
|
|
LOWER => '[a-z]', |
|
41
|
|
|
|
|
|
|
UPPER => '[A-Z]', |
|
42
|
|
|
|
|
|
|
DIGIT => '[0-9]', |
|
43
|
|
|
|
|
|
|
OCTAL => '[0-7]', |
|
44
|
|
|
|
|
|
|
HEX => '[0-9a-fA-F]', |
|
45
|
|
|
|
|
|
|
ALNUM => '[a-zA-Z0-9]', |
|
46
|
|
|
|
|
|
|
CONTROL => '[\x00-\x1f]', |
|
47
|
|
|
|
|
|
|
HICHAR => '[\x7f-\x{ffff}]', |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# Ranges - for use inside character classes |
|
50
|
|
|
|
|
|
|
WORDS => '0-9A-Za-z_', |
|
51
|
|
|
|
|
|
|
BLANKS => '\ \t', |
|
52
|
|
|
|
|
|
|
ALPHAS => 'a-zA-Z', |
|
53
|
|
|
|
|
|
|
LOWERS => 'a-z', |
|
54
|
|
|
|
|
|
|
UPPERS => 'A-Z', |
|
55
|
|
|
|
|
|
|
DIGITS => '0-9', |
|
56
|
|
|
|
|
|
|
OCTALS => '0-7', |
|
57
|
|
|
|
|
|
|
HEXS => '0-9a-fA-F', |
|
58
|
|
|
|
|
|
|
ALNUMS => 'a-zA-Z0-9', |
|
59
|
|
|
|
|
|
|
CONTROLS => '\x00-\x1f', |
|
60
|
|
|
|
|
|
|
HICHARS => '\x7f-\x{ffff}', |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
# Paired punctuation |
|
63
|
|
|
|
|
|
|
SINGLE => "'", |
|
64
|
|
|
|
|
|
|
TICK => "'", |
|
65
|
|
|
|
|
|
|
DOUBLE => '"', |
|
66
|
|
|
|
|
|
|
GRAVE => '`', |
|
67
|
|
|
|
|
|
|
LPAREN => '\(', |
|
68
|
|
|
|
|
|
|
RPAREN => '\)', |
|
69
|
|
|
|
|
|
|
LCURLY => '\{', |
|
70
|
|
|
|
|
|
|
RCURLY => '\}', |
|
71
|
|
|
|
|
|
|
LSQUARE => '\[', |
|
72
|
|
|
|
|
|
|
RSQUARE => '\]', |
|
73
|
|
|
|
|
|
|
LANGLE => '<', |
|
74
|
|
|
|
|
|
|
RANGLE => '\>', |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# Other ASCII punctuation |
|
77
|
|
|
|
|
|
|
BANG => '!', |
|
78
|
|
|
|
|
|
|
AT => '\@', |
|
79
|
|
|
|
|
|
|
HASH => '\#', |
|
80
|
|
|
|
|
|
|
DOLLAR => '\$', |
|
81
|
|
|
|
|
|
|
PERCENT => '%', |
|
82
|
|
|
|
|
|
|
CARET => '\^', |
|
83
|
|
|
|
|
|
|
AMP => '&', |
|
84
|
|
|
|
|
|
|
STAR => '\*', |
|
85
|
|
|
|
|
|
|
TILDE => '\~', |
|
86
|
|
|
|
|
|
|
UNDER => '_', |
|
87
|
|
|
|
|
|
|
DASH => '\-', |
|
88
|
|
|
|
|
|
|
PLUS => '\+', |
|
89
|
|
|
|
|
|
|
EQUAL => '=', |
|
90
|
|
|
|
|
|
|
PIPE => '\|', |
|
91
|
|
|
|
|
|
|
BACK => '\\\\', |
|
92
|
|
|
|
|
|
|
COLON => ':', |
|
93
|
|
|
|
|
|
|
SEMI => ';', |
|
94
|
|
|
|
|
|
|
COMMA => ',', |
|
95
|
|
|
|
|
|
|
DOT => '\.', |
|
96
|
|
|
|
|
|
|
QMARK => '\?', |
|
97
|
|
|
|
|
|
|
SLASH => '/', |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
# Special rules for named control chars |
|
100
|
|
|
|
|
|
|
BS => '\x08', # Backspace |
|
101
|
|
|
|
|
|
|
FF => '\x0C', # Formfeed |
|
102
|
|
|
|
|
|
|
}; |
|
103
|
|
|
|
|
|
|
|
|
104
|
37
|
|
|
37
|
0
|
89
|
sub atoms { return $atoms } |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
1; |