rley 0.8.03 → 0.8.09
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rubocop.yml +49 -8
- data/CHANGELOG.md +35 -0
- data/LICENSE.txt +1 -1
- data/README.md +1 -1
- data/appveyor.yml +1 -3
- data/examples/NLP/benchmark_pico_en.rb +6 -6
- data/examples/NLP/engtagger.rb +6 -6
- data/examples/data_formats/JSON/README.md +34 -0
- data/examples/data_formats/JSON/sample01.json +3 -0
- data/examples/data_formats/JSON/sample01.svg +36 -0
- data/examples/data_formats/JSON/sample02.json +6 -0
- data/examples/data_formats/JSON/sample02.svg +128 -0
- data/examples/data_formats/JSON/sample03.json +88 -0
- data/examples/general/calc_iter1/README.md +26 -0
- data/examples/general/calc_iter1/calc_lexer.rb +1 -1
- data/examples/general/calc_iter2/README.md +55 -0
- data/examples/general/calc_iter2/calc_lexer.rb +1 -1
- data/examples/general/calc_iter2/sample_result.txt +60 -0
- data/examples/general/general_examples.md +37 -0
- data/examples/general/left.rb +1 -1
- data/examples/general/right.rb +1 -1
- data/examples/tokenizer/README.md +51 -0
- data/examples/tokenizer/loxxy_raw_scanner.rex +109 -0
- data/examples/tokenizer/loxxy_raw_scanner.rex.rb +261 -0
- data/examples/tokenizer/loxxy_tokenizer.rb +113 -0
- data/examples/tokenizer/run_tokenizer.rb +33 -0
- data/examples/tokenizer/tokens.yml +249 -0
- data/lib/rley/constants.rb +1 -1
- data/lib/rley/engine.rb +2 -2
- data/lib/rley/interface.rb +3 -3
- data/lib/rley/lexical/literal.rb +29 -0
- data/lib/rley/lexical/token.rb +7 -4
- data/lib/rley/ptree/non_terminal_node.rb +1 -1
- data/lib/rley/rgn/all_notation_nodes.rb +5 -0
- data/lib/rley/{notation → rgn}/ast_builder.rb +19 -12
- data/lib/rley/{notation → rgn}/ast_node.rb +13 -12
- data/lib/rley/{notation → rgn}/ast_visitor.rb +10 -10
- data/lib/rley/rgn/composite_node.rb +28 -0
- data/lib/rley/{notation → rgn}/grammar.rb +1 -1
- data/lib/rley/{notation → rgn}/grammar_builder.rb +86 -124
- data/lib/rley/{notation → rgn}/parser.rb +7 -7
- data/lib/rley/rgn/repetition_node.rb +62 -0
- data/lib/rley/rgn/sequence_node.rb +30 -0
- data/lib/rley/{notation → rgn}/symbol_node.rb +15 -7
- data/lib/rley/{notation → rgn}/tokenizer.rb +4 -4
- data/lib/rley/syntax/base_grammar_builder.rb +0 -2
- data/lib/rley/syntax/grm_symbol.rb +0 -4
- data/lib/rley/syntax/non_terminal.rb +4 -0
- data/lib/rley/syntax/terminal.rb +10 -6
- data/lib/rley.rb +1 -1
- data/spec/rley/lexical/literal_spec.rb +33 -0
- data/spec/rley/lexical/token_spec.rb +15 -4
- data/spec/rley/parser/dangling_else_spec.rb +5 -7
- data/spec/rley/parser/gfg_chart_spec.rb +0 -1
- data/spec/rley/parser/gfg_earley_parser_spec.rb +179 -184
- data/spec/rley/parser/gfg_parsing_spec.rb +1 -2
- data/spec/rley/{notation → rgn}/grammar_builder_spec.rb +60 -56
- data/spec/rley/{notation → rgn}/parser_spec.rb +36 -24
- data/spec/rley/rgn/repetition_node_spec.rb +56 -0
- data/spec/rley/rgn/sequence_node_spec.rb +48 -0
- data/spec/rley/rgn/symbol_node_spec.rb +33 -0
- data/spec/rley/{notation → rgn}/tokenizer_spec.rb +2 -2
- data/spec/rley/support/ambiguous_grammar_helper.rb +2 -2
- data/spec/rley/support/grammar_int_seq_helper.rb +2 -2
- data/spec/rley/syntax/base_grammar_builder_spec.rb +7 -7
- data/spec/rley/syntax/grammar_spec.rb +6 -9
- metadata +58 -39
- data/lib/rley/notation/all_notation_nodes.rb +0 -4
- data/lib/rley/notation/grouping_node.rb +0 -23
- data/lib/rley/notation/sequence_node.rb +0 -35
- data/lib/rley/parser/parse_tracer.rb +0 -103
- data/lib/rley/syntax/literal.rb +0 -20
- data/lib/rley/syntax/verbatim_symbol.rb +0 -27
- data/spec/rley/syntax/literal_spec.rb +0 -31
- data/spec/rley/syntax/verbatim_symbol_spec.rb +0 -38
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 9734bc9875c8931a5cd5c5497df1a77a3c938076c86d2748557b8ec901d09de6
|
|
4
|
+
data.tar.gz: 20a2a6a9b88752645cf731f6790b7f89729fb108f13701048a6cc8a2c65521f6
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e203c3d6cf1b4f8b32a16af06ffe2a4548f8a53c37a2677fd13e8b3695a1e482f7d46177b3861d0b5c5b6139827133d09d1213821a7ec91b8dd805fcf3eac4dd
|
|
7
|
+
data.tar.gz: 43be3973376040fed3a9db55207d68171a0a6084ad9a102abcd26f47d60600c8aa9165a134c67b0f443e73e4e0cdd2d5a65e5271f63081a21f83aea0550b4474
|
data/.rubocop.yml
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
AllCops:
|
|
2
2
|
Exclude:
|
|
3
|
-
- '
|
|
4
|
-
- 'exp/**/*'
|
|
3
|
+
- 'exp/**/*'
|
|
5
4
|
|
|
6
5
|
Gemspec/DateAssignment:
|
|
7
6
|
Enabled: true
|
|
8
7
|
|
|
8
|
+
Gemspec/RequireMFA: # new in 1.23
|
|
9
|
+
Enabled: false
|
|
10
|
+
|
|
9
11
|
Layout/ArgumentAlignment:
|
|
10
12
|
Enabled: false
|
|
11
13
|
|
|
@@ -81,6 +83,9 @@ Layout/TrailingEmptyLines:
|
|
|
81
83
|
Layout/TrailingWhitespace:
|
|
82
84
|
Enabled: true
|
|
83
85
|
|
|
86
|
+
Lint/AmbiguousOperatorPrecedence:
|
|
87
|
+
Enabled: true
|
|
88
|
+
|
|
84
89
|
Lint/AmbiguousAssignment:
|
|
85
90
|
Enabled: true
|
|
86
91
|
|
|
@@ -105,6 +110,9 @@ Lint/EmptyClass:
|
|
|
105
110
|
Lint/EmptyInPattern:
|
|
106
111
|
Enabled: true
|
|
107
112
|
|
|
113
|
+
Lint/IncompatibleIoSelectWithFiberScheduler:
|
|
114
|
+
Enabled: true
|
|
115
|
+
|
|
108
116
|
Lint/LambdaWithoutLiteralBlock:
|
|
109
117
|
Enabled: true
|
|
110
118
|
|
|
@@ -126,6 +134,9 @@ Lint/RaiseException:
|
|
|
126
134
|
Lint/RedundantDirGlobSort:
|
|
127
135
|
Enabled: true
|
|
128
136
|
|
|
137
|
+
Lint/RequireRelativeSelfPath:
|
|
138
|
+
Enabled: true
|
|
139
|
+
|
|
129
140
|
Lint/RescueException:
|
|
130
141
|
Enabled: true
|
|
131
142
|
|
|
@@ -153,6 +164,9 @@ Lint/UnusedMethodArgument:
|
|
|
153
164
|
Lint/UselessAccessModifier:
|
|
154
165
|
Enabled: true
|
|
155
166
|
|
|
167
|
+
Lint/UselessRuby2Keywords: # new in 1.23
|
|
168
|
+
Enabled: true
|
|
169
|
+
|
|
156
170
|
Lint/Void:
|
|
157
171
|
Enabled: false
|
|
158
172
|
|
|
@@ -192,6 +206,9 @@ Metrics/ModuleLength:
|
|
|
192
206
|
Metrics/PerceivedComplexity:
|
|
193
207
|
Enabled: false
|
|
194
208
|
|
|
209
|
+
Naming/BlockForwarding: # new in 1.24
|
|
210
|
+
Enabled: true
|
|
211
|
+
|
|
195
212
|
Naming/ConstantName:
|
|
196
213
|
Enabled: false
|
|
197
214
|
|
|
@@ -213,6 +230,9 @@ Naming/MethodName:
|
|
|
213
230
|
Naming/VariableName:
|
|
214
231
|
Enabled: false
|
|
215
232
|
|
|
233
|
+
Security/IoMethods:
|
|
234
|
+
Enabled: true
|
|
235
|
+
|
|
216
236
|
Style/Alias:
|
|
217
237
|
Enabled: true
|
|
218
238
|
|
|
@@ -267,6 +287,12 @@ Style/ExpandPathArguments:
|
|
|
267
287
|
Style/ExponentialNotation:
|
|
268
288
|
Enabled: true
|
|
269
289
|
|
|
290
|
+
Style/FileRead: # new in 1.24
|
|
291
|
+
Enabled: true
|
|
292
|
+
|
|
293
|
+
Style/FileWrite: # new in 1.24
|
|
294
|
+
Enabled: true
|
|
295
|
+
|
|
270
296
|
Style/GuardClause:
|
|
271
297
|
Enabled: false
|
|
272
298
|
|
|
@@ -291,11 +317,14 @@ Style/InPatternThen:
|
|
|
291
317
|
Style/InverseMethods:
|
|
292
318
|
Enabled: false
|
|
293
319
|
|
|
320
|
+
Style/MapToHash: # new in 1.24
|
|
321
|
+
Enabled: true
|
|
322
|
+
|
|
294
323
|
Style/MissingRespondToMissing:
|
|
295
324
|
Enabled: false
|
|
296
|
-
|
|
325
|
+
|
|
297
326
|
Style/MultilineInPatternThen:
|
|
298
|
-
Enabled: true
|
|
327
|
+
Enabled: true
|
|
299
328
|
|
|
300
329
|
Style/NegatedIfElseCondition:
|
|
301
330
|
Enabled: true
|
|
@@ -306,11 +335,20 @@ Style/Next:
|
|
|
306
335
|
Style/NilLambda:
|
|
307
336
|
Enabled: true
|
|
308
337
|
|
|
338
|
+
Style/NumberedParameters:
|
|
339
|
+
Enabled: true
|
|
340
|
+
|
|
341
|
+
Style/NumberedParametersLimit:
|
|
342
|
+
Enabled: true
|
|
343
|
+
|
|
309
344
|
Style/NumericLiterals:
|
|
310
345
|
Enabled: false
|
|
311
|
-
|
|
346
|
+
|
|
347
|
+
Style/OpenStructUse: # new in 1.23
|
|
348
|
+
Enabled: true
|
|
349
|
+
|
|
312
350
|
Style/QuotedSymbols:
|
|
313
|
-
Enabled: true
|
|
351
|
+
Enabled: true
|
|
314
352
|
|
|
315
353
|
Style/RaiseArgs:
|
|
316
354
|
Enabled: true
|
|
@@ -323,9 +361,9 @@ Style/RedundantReturn:
|
|
|
323
361
|
|
|
324
362
|
Style/RedundantSelf:
|
|
325
363
|
Enabled: true
|
|
326
|
-
|
|
364
|
+
|
|
327
365
|
Style/RedundantSelfAssignmentBranch:
|
|
328
|
-
Enabled: true
|
|
366
|
+
Enabled: true
|
|
329
367
|
|
|
330
368
|
Style/RegexpLiteral:
|
|
331
369
|
Enabled: false
|
|
@@ -333,6 +371,9 @@ Style/RegexpLiteral:
|
|
|
333
371
|
Style/PercentLiteralDelimiters:
|
|
334
372
|
Enabled: false
|
|
335
373
|
|
|
374
|
+
Style/SelectByRegexp:
|
|
375
|
+
Enabled: true
|
|
376
|
+
|
|
336
377
|
Style/StderrPuts:
|
|
337
378
|
Enabled: false
|
|
338
379
|
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,38 @@
|
|
|
1
|
+
### 0.8.09 / 2022-01-28
|
|
2
|
+
- Added code for coming tutorial
|
|
3
|
+
|
|
4
|
+
* [NEW] Folder `tutorial` contains code used in tutorial (in wiki)
|
|
5
|
+
* [NEW] Folders `TOML\iter_1` .. `TOML\iter_2` contains code for a TOML parser
|
|
6
|
+
* [CHANGE] File `.rubocop.yml` updated to take into account new 1.25 cops.
|
|
7
|
+
* [CHANGE] File `.rubocop.yml` updated to take into account new 1.25 cops.
|
|
8
|
+
|
|
9
|
+
### 0.8.08 / 2021-10-31
|
|
10
|
+
- Fixes in example files, Refactored module `Notation` renamed `to `RGN´
|
|
11
|
+
|
|
12
|
+
* [CHANGE] Module `Notation` changed to `RGN`.
|
|
13
|
+
|
|
14
|
+
* [FIX] `examples/general/calc_iter1/CalcLexer#initialize` now strips whitespaces at end of expression to parse.
|
|
15
|
+
* [FIX] `examples/general/calc_iter2/CalcLexer#initialize` now strips whitespaces at end of expression to parse.
|
|
16
|
+
* [FIX] File `examples/general/left.rb` Call to wrong grammar builder
|
|
17
|
+
* [FIX] File `examples/general/right.rb` Call to wrong grammar builder
|
|
18
|
+
* [FIX] File `examples/NLP/benchmark_pico_en.rb` Grammar rules used obsolete rule syntax
|
|
19
|
+
* [FIX] File `examples/NLP/engtagger.rb` Grammar rules used obsolete rule syntax
|
|
20
|
+
|
|
21
|
+
### 0.8.06 / 2021-10-06
|
|
22
|
+
- Added more comment in `/examples/tokenizer` files
|
|
23
|
+
|
|
24
|
+
* [CHANGE] File `rley.gemspec` some files weren't put the gem files.
|
|
25
|
+
|
|
26
|
+
### 0.8.05 / 2021-10-04
|
|
27
|
+
- Added example of generated scanner. Unused class removal, code re-styling to please `Rubocop`
|
|
28
|
+
|
|
29
|
+
* [NEW] Folder `example\tokenizer` contains an example with a scanner that was generated.
|
|
30
|
+
* [NEW] Class `Rley::Lexical::Literal` a specialization of Token class for literal tokens.
|
|
31
|
+
* [CHANGE] File `.rubocop.yml` updated to take into account new 1.21 and 1.22 cops.
|
|
32
|
+
* [DELETED] Class `Rley::Parser::ParserTracer` this class was no more in use.
|
|
33
|
+
* [DELETED] Class `Rley::Syntax::Literal` this class was unused.
|
|
34
|
+
* [DELETED] Class `Rley::Syntax::VerbatimSymbol` this class was unused.
|
|
35
|
+
|
|
1
36
|
### 0.8.03 / 2021-08-27
|
|
2
37
|
- Added missing method in `ASTBaseBuilder` class
|
|
3
38
|
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
|
@@ -458,5 +458,5 @@ standard parser textbooks. Here are a few references (and links) of papers on GF
|
|
|
458
458
|
|
|
459
459
|
Copyright
|
|
460
460
|
---------
|
|
461
|
-
Copyright (c) 2014-
|
|
461
|
+
Copyright (c) 2014-2022, Dimitri Geshef.
|
|
462
462
|
__Rley__ is released under the MIT License see [LICENSE.txt](https://github.com/famished-tiger/Rley/blob/master/LICENSE.txt) for details.
|
data/appveyor.yml
CHANGED
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
version: '{build}'
|
|
2
2
|
max_jobs: 5
|
|
3
3
|
environment:
|
|
4
|
-
matrix:
|
|
4
|
+
matrix:
|
|
5
5
|
- Ruby_version: 26-x64
|
|
6
6
|
- Ruby_version: 25-x64
|
|
7
7
|
- Ruby_version: 24-x64
|
|
8
|
-
- Ruby_version: 23-x64
|
|
9
8
|
- Ruby_version: 26
|
|
10
9
|
- Ruby_version: 25
|
|
11
10
|
- Ruby_version: 24
|
|
12
|
-
- Ruby_version: 23
|
|
13
11
|
|
|
14
12
|
install:
|
|
15
13
|
- set PATH=C:\Ruby%Ruby_version%\bin;%PATH%
|
|
@@ -24,13 +24,13 @@ engine.build_grammar do
|
|
|
24
24
|
add_terminals('Determiner', 'Preposition')
|
|
25
25
|
|
|
26
26
|
# Here we define the productions (= grammar rules)
|
|
27
|
-
rule 'S' =>
|
|
27
|
+
rule 'S' => 'NP VP'
|
|
28
28
|
rule 'NP' => 'Proper-Noun'
|
|
29
|
-
rule 'NP' =>
|
|
30
|
-
rule 'NP' =>
|
|
31
|
-
rule 'VP' =>
|
|
32
|
-
rule 'VP' =>
|
|
33
|
-
rule 'PP' =>
|
|
29
|
+
rule 'NP' => 'Determiner Noun'
|
|
30
|
+
rule 'NP' => 'Determiner Noun PP'
|
|
31
|
+
rule 'VP' => 'Verb NP'
|
|
32
|
+
rule 'VP' => 'Verb NP PP'
|
|
33
|
+
rule 'PP' => 'Preposition NP'
|
|
34
34
|
end
|
|
35
35
|
|
|
36
36
|
########################################
|
data/examples/NLP/engtagger.rb
CHANGED
|
@@ -136,13 +136,13 @@ nlp_engine.build_grammar do
|
|
|
136
136
|
add_terminals('DET', 'IN', 'VBD')
|
|
137
137
|
|
|
138
138
|
# Here we define the productions (= grammar rules)
|
|
139
|
-
rule 'S' =>
|
|
139
|
+
rule 'S' => 'NP VP'
|
|
140
140
|
rule 'NP' => 'NNP'
|
|
141
|
-
rule 'NP' =>
|
|
142
|
-
rule 'NP' =>
|
|
143
|
-
rule 'VP' =>
|
|
144
|
-
rule 'VP' =>
|
|
145
|
-
rule 'PP' =>
|
|
141
|
+
rule 'NP' => 'DET NN'
|
|
142
|
+
rule 'NP' => 'DET NN PP'
|
|
143
|
+
rule 'VP' => 'VBD NP'
|
|
144
|
+
rule 'VP' => 'VBD NP PP'
|
|
145
|
+
rule 'PP' => 'IN NP'
|
|
146
146
|
end
|
|
147
147
|
|
|
148
148
|
# text = "Yo I'm not done with you"
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
## Demo JSON parser
|
|
2
|
+
|
|
3
|
+
### Source files
|
|
4
|
+
This sample project consists of the following files:
|
|
5
|
+
- **cli_opt.rb** containing the utility class `CLIOptions` that retrieves the
|
|
6
|
+
command-line options.
|
|
7
|
+
|
|
8
|
+
- **json_ast_builder.rb** containing the class `JSONASTBuilder` that creates
|
|
9
|
+
the abstract syntax trees (AST) representation for a given parse result.
|
|
10
|
+
|
|
11
|
+
- **json_ast_nodes.rb** containing the node classs for implementing the AST.
|
|
12
|
+
The nodes are augmented with methods that allow the re-use of some formatters
|
|
13
|
+
designed initially for CST (Concrete Syntax Tree). The nodes have a 'to_ruby'
|
|
14
|
+
method that enable a conversion of the input JSON text into Ruby representation.
|
|
15
|
+
|
|
16
|
+
- **JSON_demo.rb** a demo command-line program.
|
|
17
|
+
It parses the JSON file specified in the command-line and outputs the parse tree
|
|
18
|
+
into different formats. For more details, run the command-line: `JSON_demo.rb --help`
|
|
19
|
+
|
|
20
|
+
- **JSON_grammar.rb** implementing the class `JSONGrammar`.
|
|
21
|
+
The grammar is a list of (production) rules that specifies the syntax of JSON data.
|
|
22
|
+
A little examination of the grammar will reveal interesting grammar features such as:
|
|
23
|
+
* Recursive rules (e.g. terminal in left-side of rule also appears in right-hand side)
|
|
24
|
+
|
|
25
|
+
- **JSON_lexer.rb** implementing the class `JSONLexer`.
|
|
26
|
+
The purpose of the lexer is to break the JSON source text into a sequence of tokens.
|
|
27
|
+
|
|
28
|
+
- **JSON_parser.rb** implementing a `JSONParser` class.
|
|
29
|
+
The parser processes the tokens stream from the lexer and delivers its results
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
- sample0x.json files of various degree of complexity.
|
|
33
|
+
|
|
34
|
+
- sample0x.svg files that are syntax tree diagrams obtained by feeding [RSyntaxTree](http://yohasebe.com/rsyntaxtree/) with the output of JSON_demo.rb. Remark: the website works best with not too complex parse trees.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<?xml version="1.0" standalone="no"?>
|
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
|
3
|
+
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
4
|
+
<svg width="469.5" height="502" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
|
5
|
+
<text style='fill: green; font-size: 16px;' x='296.53125' y='490'> John Doe</text>
|
|
6
|
+
<text style='fill: green; font-size: 16px;' x='109.53125' y='424'> name</text>
|
|
7
|
+
<text style='fill: green; font-size: 16px;' x='221.2421875' y='424'> :</text>
|
|
8
|
+
<text style='fill: blue; font-size: 16px;' x='309.3828125' y='424'>string</text>
|
|
9
|
+
<polygon style='fill: white; stroke: black; stroke-width:1;' points='361 467 297 467 329 431' />
|
|
10
|
+
<text style='fill: blue; font-size: 16px;' x='109.796875' y='358'>string</text>
|
|
11
|
+
<line style='stroke:black; stroke-width:1;' x1='130' y1='401' x2='130' y2='365' />
|
|
12
|
+
<text style='fill: blue; font-size: 16px;' x='164.796875' y='358'>name-separator</text>
|
|
13
|
+
<line style='stroke:black; stroke-width:1;' x1='223' y1='401' x2='223' y2='365' />
|
|
14
|
+
<text style='fill: blue; font-size: 16px;' x='309.75' y='358'>value</text>
|
|
15
|
+
<line style='stroke:black; stroke-width:1;' x1='329' y1='401' x2='329' y2='365' />
|
|
16
|
+
<text style='fill: green; font-size: 16px;' x='46.5078125' y='292'> {</text>
|
|
17
|
+
<text style='fill: blue; font-size: 16px;' x='198.40234375' y='292'>member</text>
|
|
18
|
+
<line style='stroke:black; stroke-width:1;' x1='130' y1='335' x2='229' y2='299' />
|
|
19
|
+
<line style='stroke:black; stroke-width:1;' x1='223' y1='335' x2='229' y2='299' />
|
|
20
|
+
<line style='stroke:black; stroke-width:1;' x1='329' y1='335' x2='229' y2='299' />
|
|
21
|
+
<text style='fill: green; font-size: 16px;' x='412.4375' y='292'> }</text>
|
|
22
|
+
<text style='fill: blue; font-size: 16px;' x='5.0' y='226'>begin-object</text>
|
|
23
|
+
<line style='stroke:black; stroke-width:1;' x1='50' y1='269' x2='50' y2='233' />
|
|
24
|
+
<text style='fill: blue; font-size: 16px;' x='185.58984375' y='226'>member-list</text>
|
|
25
|
+
<line style='stroke:black; stroke-width:1;' x1='229' y1='269' x2='229' y2='233' />
|
|
26
|
+
<text style='fill: blue; font-size: 16px;' x='376.96875' y='226'>end-object</text>
|
|
27
|
+
<line style='stroke:black; stroke-width:1;' x1='416' y1='269' x2='416' y2='233' />
|
|
28
|
+
<text style='fill: blue; font-size: 16px;' x='209.984375' y='160'>object</text>
|
|
29
|
+
<line style='stroke:black; stroke-width:1;' x1='50' y1='203' x2='233' y2='167' />
|
|
30
|
+
<line style='stroke:black; stroke-width:1;' x1='229' y1='203' x2='233' y2='167' />
|
|
31
|
+
<line style='stroke:black; stroke-width:1;' x1='416' y1='203' x2='233' y2='167' />
|
|
32
|
+
<text style='fill: blue; font-size: 16px;' x='213.25' y='94'>value</text>
|
|
33
|
+
<line style='stroke:black; stroke-width:1;' x1='233' y1='137' x2='233' y2='101' />
|
|
34
|
+
<text style='fill: blue; font-size: 16px;' x='197.03125' y='28'>JSON-text</text>
|
|
35
|
+
<line style='stroke:black; stroke-width:1;' x1='233' y1='71' x2='233' y2='35' />
|
|
36
|
+
</svg>
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
<?xml version="1.0" standalone="no"?>
|
|
2
|
+
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
|
|
3
|
+
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
|
4
|
+
<svg width="2060.15625" height="766" version="1.1" xmlns="http://www.w3.org/2000/svg">
|
|
5
|
+
<text style='fill: green; font-size: 16px;' x='1597.078125' y='754'> home</text>
|
|
6
|
+
<text style='fill: green; font-size: 16px;' x='320.75' y='688'> 1</text>
|
|
7
|
+
<text style='fill: blue; font-size: 16px;' x='1597.265625' y='688'>string</text>
|
|
8
|
+
<line style='stroke:black; stroke-width:1;' x1='1617' y1='731' x2='1617' y2='695' />
|
|
9
|
+
<text style='fill: green; font-size: 16px;' x='1825.0' y='688'> green</text>
|
|
10
|
+
<text style='fill: green; font-size: 16px;' x='122.84375' y='622'> id</text>
|
|
11
|
+
<text style='fill: green; font-size: 16px;' x='220.7109375' y='622'> :</text>
|
|
12
|
+
<text style='fill: blue; font-size: 16px;' x='296.0' y='622'>number</text>
|
|
13
|
+
<line style='stroke:black; stroke-width:1;' x1='325' y1='665' x2='325' y2='629' />
|
|
14
|
+
<text style='fill: green; font-size: 16px;' x='685.109375' y='622'> A green door</text>
|
|
15
|
+
<text style='fill: blue; font-size: 16px;' x='1597.6328125' y='622'>value</text>
|
|
16
|
+
<line style='stroke:black; stroke-width:1;' x1='1617' y1='665' x2='1617' y2='629' />
|
|
17
|
+
<text style='fill: green; font-size: 16px;' x='1750.75' y='622'> ,</text>
|
|
18
|
+
<text style='fill: blue; font-size: 16px;' x='1825.984375' y='622'>string</text>
|
|
19
|
+
<line style='stroke:black; stroke-width:1;' x1='1846' y1='665' x2='1846' y2='629' />
|
|
20
|
+
<text style='fill: blue; font-size: 16px;' x='109.53125' y='556'>string</text>
|
|
21
|
+
<line style='stroke:black; stroke-width:1;' x1='129' y1='599' x2='129' y2='563' />
|
|
22
|
+
<text style='fill: blue; font-size: 16px;' x='164.265625' y='556'>name-separator</text>
|
|
23
|
+
<line style='stroke:black; stroke-width:1;' x1='223' y1='599' x2='223' y2='563' />
|
|
24
|
+
<text style='fill: blue; font-size: 16px;' x='305.0546875' y='556'>value</text>
|
|
25
|
+
<line style='stroke:black; stroke-width:1;' x1='325' y1='599' x2='325' y2='563' />
|
|
26
|
+
<text style='fill: green; font-size: 16px;' x='498.109375' y='556'> name</text>
|
|
27
|
+
<text style='fill: green; font-size: 16px;' x='609.8203125' y='556'> :</text>
|
|
28
|
+
<text style='fill: blue; font-size: 16px;' x='712.2421875' y='556'>string</text>
|
|
29
|
+
<polygon style='fill: white; stroke: black; stroke-width:1;' points='779 599 686 599 732 563' />
|
|
30
|
+
<text style='fill: green; font-size: 16px;' x='1119.0078125' y='556'> 12.50</text>
|
|
31
|
+
<text style='fill: green; font-size: 16px;' x='1538.2578125' y='556'> [</text>
|
|
32
|
+
<text style='fill: blue; font-size: 16px;' x='1575.671875' y='556'>array-items</text>
|
|
33
|
+
<line style='stroke:black; stroke-width:1;' x1='1617' y1='599' x2='1617' y2='563' />
|
|
34
|
+
<text style='fill: blue; font-size: 16px;' x='1695.0' y='556'>value-separator</text>
|
|
35
|
+
<line style='stroke:black; stroke-width:1;' x1='1752' y1='599' x2='1752' y2='563' />
|
|
36
|
+
<text style='fill: blue; font-size: 16px;' x='1826.3515625' y='556'>value</text>
|
|
37
|
+
<line style='stroke:black; stroke-width:1;' x1='1846' y1='599' x2='1846' y2='563' />
|
|
38
|
+
<text style='fill: green; font-size: 16px;' x='1914.8671875' y='556'> ]</text>
|
|
39
|
+
<text style='fill: blue; font-size: 16px;' x='195.921875' y='490'>member</text>
|
|
40
|
+
<line style='stroke:black; stroke-width:1;' x1='129' y1='533' x2='227' y2='497' />
|
|
41
|
+
<line style='stroke:black; stroke-width:1;' x1='223' y1='533' x2='227' y2='497' />
|
|
42
|
+
<line style='stroke:black; stroke-width:1;' x1='325' y1='533' x2='227' y2='497' />
|
|
43
|
+
<text style='fill: green; font-size: 16px;' x='423.859375' y='490'> ,</text>
|
|
44
|
+
<text style='fill: blue; font-size: 16px;' x='498.375' y='490'>string</text>
|
|
45
|
+
<line style='stroke:black; stroke-width:1;' x1='518' y1='533' x2='518' y2='497' />
|
|
46
|
+
<text style='fill: blue; font-size: 16px;' x='553.375' y='490'>name-separator</text>
|
|
47
|
+
<line style='stroke:black; stroke-width:1;' x1='612' y1='533' x2='612' y2='497' />
|
|
48
|
+
<text style='fill: blue; font-size: 16px;' x='712.609375' y='490'>value</text>
|
|
49
|
+
<line style='stroke:black; stroke-width:1;' x1='732' y1='533' x2='732' y2='497' />
|
|
50
|
+
<text style='fill: green; font-size: 16px;' x='926.921875' y='490'> price</text>
|
|
51
|
+
<text style='fill: green; font-size: 16px;' x='1035.2890625' y='490'> :</text>
|
|
52
|
+
<text style='fill: blue; font-size: 16px;' x='1110.578125' y='490'>number</text>
|
|
53
|
+
<line style='stroke:black; stroke-width:1;' x1='1139' y1='533' x2='1139' y2='497' />
|
|
54
|
+
<text style='fill: blue; font-size: 16px;' x='1499.15625' y='490'>begin-array</text>
|
|
55
|
+
<line style='stroke:black; stroke-width:1;' x1='1541' y1='533' x2='1541' y2='497' />
|
|
56
|
+
<text style='fill: blue; font-size: 16px;' x='1690.03125' y='490'>array-items</text>
|
|
57
|
+
<line style='stroke:black; stroke-width:1;' x1='1617' y1='533' x2='1731' y2='497' />
|
|
58
|
+
<line style='stroke:black; stroke-width:1;' x1='1752' y1='533' x2='1731' y2='497' />
|
|
59
|
+
<line style='stroke:black; stroke-width:1;' x1='1846' y1='533' x2='1731' y2='497' />
|
|
60
|
+
<text style='fill: blue; font-size: 16px;' x='1881.703125' y='490'>end-array</text>
|
|
61
|
+
<line style='stroke:black; stroke-width:1;' x1='1917' y1='533' x2='1917' y2='497' />
|
|
62
|
+
<text style='fill: blue; font-size: 16px;' x='183.109375' y='424'>member-list</text>
|
|
63
|
+
<line style='stroke:black; stroke-width:1;' x1='227' y1='467' x2='227' y2='431' />
|
|
64
|
+
<text style='fill: blue; font-size: 16px;' x='368.109375' y='424'>value-separator</text>
|
|
65
|
+
<line style='stroke:black; stroke-width:1;' x1='426' y1='467' x2='426' y2='431' />
|
|
66
|
+
<text style='fill: blue; font-size: 16px;' x='594.12109375' y='424'>member</text>
|
|
67
|
+
<line style='stroke:black; stroke-width:1;' x1='518' y1='467' x2='625' y2='431' />
|
|
68
|
+
<line style='stroke:black; stroke-width:1;' x1='612' y1='467' x2='625' y2='431' />
|
|
69
|
+
<line style='stroke:black; stroke-width:1;' x1='732' y1='467' x2='625' y2='431' />
|
|
70
|
+
<text style='fill: green; font-size: 16px;' x='849.859375' y='424'> ,</text>
|
|
71
|
+
<text style='fill: blue; font-size: 16px;' x='924.109375' y='424'>string</text>
|
|
72
|
+
<line style='stroke:black; stroke-width:1;' x1='944' y1='467' x2='944' y2='431' />
|
|
73
|
+
<text style='fill: blue; font-size: 16px;' x='978.84375' y='424'>name-separator</text>
|
|
74
|
+
<line style='stroke:black; stroke-width:1;' x1='1037' y1='467' x2='1037' y2='431' />
|
|
75
|
+
<text style='fill: blue; font-size: 16px;' x='1119.6328125' y='424'>value</text>
|
|
76
|
+
<line style='stroke:black; stroke-width:1;' x1='1139' y1='467' x2='1139' y2='431' />
|
|
77
|
+
<text style='fill: green; font-size: 16px;' x='1317.6875' y='424'> tags</text>
|
|
78
|
+
<text style='fill: green; font-size: 16px;' x='1423.8671875' y='424'> :</text>
|
|
79
|
+
<text style='fill: blue; font-size: 16px;' x='1709.4296875' y='424'>array</text>
|
|
80
|
+
<line style='stroke:black; stroke-width:1;' x1='1541' y1='467' x2='1729' y2='431' />
|
|
81
|
+
<line style='stroke:black; stroke-width:1;' x1='1731' y1='467' x2='1729' y2='431' />
|
|
82
|
+
<line style='stroke:black; stroke-width:1;' x1='1917' y1='467' x2='1729' y2='431' />
|
|
83
|
+
<text style='fill: blue; font-size: 16px;' x='382.208984375' y='358'>member-list</text>
|
|
84
|
+
<line style='stroke:black; stroke-width:1;' x1='227' y1='401' x2='426' y2='365' />
|
|
85
|
+
<line style='stroke:black; stroke-width:1;' x1='426' y1='401' x2='426' y2='365' />
|
|
86
|
+
<line style='stroke:black; stroke-width:1;' x1='625' y1='401' x2='426' y2='365' />
|
|
87
|
+
<text style='fill: blue; font-size: 16px;' x='794.109375' y='358'>value-separator</text>
|
|
88
|
+
<line style='stroke:black; stroke-width:1;' x1='852' y1='401' x2='852' y2='365' />
|
|
89
|
+
<text style='fill: blue; font-size: 16px;' x='1010.5' y='358'>member</text>
|
|
90
|
+
<line style='stroke:black; stroke-width:1;' x1='944' y1='401' x2='1042' y2='365' />
|
|
91
|
+
<line style='stroke:black; stroke-width:1;' x1='1037' y1='401' x2='1042' y2='365' />
|
|
92
|
+
<line style='stroke:black; stroke-width:1;' x1='1139' y1='401' x2='1042' y2='365' />
|
|
93
|
+
<text style='fill: green; font-size: 16px;' x='1238.4375' y='358'> ,</text>
|
|
94
|
+
<text style='fill: blue; font-size: 16px;' x='1312.6875' y='358'>string</text>
|
|
95
|
+
<line style='stroke:black; stroke-width:1;' x1='1333' y1='401' x2='1333' y2='365' />
|
|
96
|
+
<text style='fill: blue; font-size: 16px;' x='1367.421875' y='358'>name-separator</text>
|
|
97
|
+
<line style='stroke:black; stroke-width:1;' x1='1426' y1='401' x2='1426' y2='365' />
|
|
98
|
+
<text style='fill: blue; font-size: 16px;' x='1709.390625' y='358'>value</text>
|
|
99
|
+
<line style='stroke:black; stroke-width:1;' x1='1729' y1='401' x2='1729' y2='365' />
|
|
100
|
+
<text style='fill: green; font-size: 16px;' x='46.5078125' y='292'> {</text>
|
|
101
|
+
<text style='fill: blue; font-size: 16px;' x='689.9482421875' y='292'>member-list</text>
|
|
102
|
+
<line style='stroke:black; stroke-width:1;' x1='426' y1='335' x2='734' y2='299' />
|
|
103
|
+
<line style='stroke:black; stroke-width:1;' x1='852' y1='335' x2='734' y2='299' />
|
|
104
|
+
<line style='stroke:black; stroke-width:1;' x1='1042' y1='335' x2='734' y2='299' />
|
|
105
|
+
<text style='fill: blue; font-size: 16px;' x='1182.6875' y='292'>value-separator</text>
|
|
106
|
+
<line style='stroke:black; stroke-width:1;' x1='1240' y1='335' x2='1240' y2='299' />
|
|
107
|
+
<text style='fill: blue; font-size: 16px;' x='1499.66796875' y='292'>member</text>
|
|
108
|
+
<line style='stroke:black; stroke-width:1;' x1='1333' y1='335' x2='1531' y2='299' />
|
|
109
|
+
<line style='stroke:black; stroke-width:1;' x1='1426' y1='335' x2='1531' y2='299' />
|
|
110
|
+
<line style='stroke:black; stroke-width:1;' x1='1729' y1='335' x2='1531' y2='299' />
|
|
111
|
+
<text style='fill: green; font-size: 16px;' x='2003.09375' y='292'> }</text>
|
|
112
|
+
<text style='fill: blue; font-size: 16px;' x='5.0' y='226'>begin-object</text>
|
|
113
|
+
<line style='stroke:black; stroke-width:1;' x1='50' y1='269' x2='50' y2='233' />
|
|
114
|
+
<text style='fill: blue; font-size: 16px;' x='1088.40185546875' y='226'>member-list</text>
|
|
115
|
+
<line style='stroke:black; stroke-width:1;' x1='734' y1='269' x2='1132' y2='233' />
|
|
116
|
+
<line style='stroke:black; stroke-width:1;' x1='1240' y1='269' x2='1132' y2='233' />
|
|
117
|
+
<line style='stroke:black; stroke-width:1;' x1='1531' y1='269' x2='1132' y2='233' />
|
|
118
|
+
<text style='fill: blue; font-size: 16px;' x='1967.625' y='226'>end-object</text>
|
|
119
|
+
<line style='stroke:black; stroke-width:1;' x1='2006' y1='269' x2='2006' y2='233' />
|
|
120
|
+
<text style='fill: blue; font-size: 16px;' x='1005.3125' y='160'>object</text>
|
|
121
|
+
<line style='stroke:black; stroke-width:1;' x1='50' y1='203' x2='1028' y2='167' />
|
|
122
|
+
<line style='stroke:black; stroke-width:1;' x1='1132' y1='203' x2='1028' y2='167' />
|
|
123
|
+
<line style='stroke:black; stroke-width:1;' x1='2006' y1='203' x2='1028' y2='167' />
|
|
124
|
+
<text style='fill: blue; font-size: 16px;' x='1008.578125' y='94'>value</text>
|
|
125
|
+
<line style='stroke:black; stroke-width:1;' x1='1028' y1='137' x2='1028' y2='101' />
|
|
126
|
+
<text style='fill: blue; font-size: 16px;' x='992.359375' y='28'>JSON-text</text>
|
|
127
|
+
<line style='stroke:black; stroke-width:1;' x1='1028' y1='71' x2='1028' y2='35' />
|
|
128
|
+
</svg>
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{"web-app": {
|
|
2
|
+
"servlet": [
|
|
3
|
+
{
|
|
4
|
+
"servlet-name": "cofaxCDS",
|
|
5
|
+
"servlet-class": "org.cofax.cds.CDSServlet",
|
|
6
|
+
"init-param": {
|
|
7
|
+
"configGlossary:installationAt": "Philadelphia, PA",
|
|
8
|
+
"configGlossary:adminEmail": "ksm@pobox.com",
|
|
9
|
+
"configGlossary:poweredBy": "Cofax",
|
|
10
|
+
"configGlossary:poweredByIcon": "/images/cofax.gif",
|
|
11
|
+
"configGlossary:staticPath": "/content/static",
|
|
12
|
+
"templateProcessorClass": "org.cofax.WysiwygTemplate",
|
|
13
|
+
"templateLoaderClass": "org.cofax.FilesTemplateLoader",
|
|
14
|
+
"templatePath": "templates",
|
|
15
|
+
"templateOverridePath": "",
|
|
16
|
+
"defaultListTemplate": "listTemplate.htm",
|
|
17
|
+
"defaultFileTemplate": "articleTemplate.htm",
|
|
18
|
+
"useJSP": false,
|
|
19
|
+
"jspListTemplate": "listTemplate.jsp",
|
|
20
|
+
"jspFileTemplate": "articleTemplate.jsp",
|
|
21
|
+
"cachePackageTagsTrack": 200,
|
|
22
|
+
"cachePackageTagsStore": 200,
|
|
23
|
+
"cachePackageTagsRefresh": 60,
|
|
24
|
+
"cacheTemplatesTrack": 100,
|
|
25
|
+
"cacheTemplatesStore": 50,
|
|
26
|
+
"cacheTemplatesRefresh": 15,
|
|
27
|
+
"cachePagesTrack": 200,
|
|
28
|
+
"cachePagesStore": 100,
|
|
29
|
+
"cachePagesRefresh": 10,
|
|
30
|
+
"cachePagesDirtyRead": 10,
|
|
31
|
+
"searchEngineListTemplate": "forSearchEnginesList.htm",
|
|
32
|
+
"searchEngineFileTemplate": "forSearchEngines.htm",
|
|
33
|
+
"searchEngineRobotsDb": "WEB-INF/robots.db",
|
|
34
|
+
"useDataStore": true,
|
|
35
|
+
"dataStoreClass": "org.cofax.SqlDataStore",
|
|
36
|
+
"redirectionClass": "org.cofax.SqlRedirection",
|
|
37
|
+
"dataStoreName": "cofax",
|
|
38
|
+
"dataStoreDriver": "com.microsoft.jdbc.sqlserver.SQLServerDriver",
|
|
39
|
+
"dataStoreUrl": "jdbc:microsoft:sqlserver://LOCALHOST:1433;DatabaseName=goon",
|
|
40
|
+
"dataStoreUser": "sa",
|
|
41
|
+
"dataStorePassword": "dataStoreTestQuery",
|
|
42
|
+
"dataStoreTestQuery": "SET NOCOUNT ON;select test='test';",
|
|
43
|
+
"dataStoreLogFile": "/usr/local/tomcat/logs/datastore.log",
|
|
44
|
+
"dataStoreInitConns": 10,
|
|
45
|
+
"dataStoreMaxConns": 100,
|
|
46
|
+
"dataStoreConnUsageLimit": 100,
|
|
47
|
+
"dataStoreLogLevel": "debug",
|
|
48
|
+
"maxUrlLength": 500}},
|
|
49
|
+
{
|
|
50
|
+
"servlet-name": "cofaxEmail",
|
|
51
|
+
"servlet-class": "org.cofax.cds.EmailServlet",
|
|
52
|
+
"init-param": {
|
|
53
|
+
"mailHost": "mail1",
|
|
54
|
+
"mailHostOverride": "mail2"}},
|
|
55
|
+
{
|
|
56
|
+
"servlet-name": "cofaxAdmin",
|
|
57
|
+
"servlet-class": "org.cofax.cds.AdminServlet"},
|
|
58
|
+
|
|
59
|
+
{
|
|
60
|
+
"servlet-name": "fileServlet",
|
|
61
|
+
"servlet-class": "org.cofax.cds.FileServlet"},
|
|
62
|
+
{
|
|
63
|
+
"servlet-name": "cofaxTools",
|
|
64
|
+
"servlet-class": "org.cofax.cms.CofaxToolsServlet",
|
|
65
|
+
"init-param": {
|
|
66
|
+
"templatePath": "toolstemplates/",
|
|
67
|
+
"log": 1,
|
|
68
|
+
"logLocation": "/usr/local/tomcat/logs/CofaxTools.log",
|
|
69
|
+
"logMaxSize": "",
|
|
70
|
+
"dataLog": 1,
|
|
71
|
+
"dataLogLocation": "/usr/local/tomcat/logs/dataLog.log",
|
|
72
|
+
"dataLogMaxSize": "",
|
|
73
|
+
"removePageCache": "/content/admin/remove?cache=pages&id=",
|
|
74
|
+
"removeTemplateCache": "/content/admin/remove?cache=templates&id=",
|
|
75
|
+
"fileTransferFolder": "/usr/local/tomcat/webapps/content/fileTransferFolder",
|
|
76
|
+
"lookInContext": 1,
|
|
77
|
+
"adminGroupID": 4,
|
|
78
|
+
"betaServer": true}}],
|
|
79
|
+
"servlet-mapping": {
|
|
80
|
+
"cofaxCDS": "/",
|
|
81
|
+
"cofaxEmail": "/cofaxutil/aemail/*",
|
|
82
|
+
"cofaxAdmin": "/admin/*",
|
|
83
|
+
"fileServlet": "/static/*",
|
|
84
|
+
"cofaxTools": "/tools/*"},
|
|
85
|
+
|
|
86
|
+
"taglib": {
|
|
87
|
+
"taglib-uri": "cofax.tld",
|
|
88
|
+
"taglib-location": "/WEB-INF/tlds/cofax.tld"}}}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
## Demo calculator (iteration 1)
|
|
2
|
+
|
|
3
|
+
### Source files
|
|
4
|
+
This sample project consists of the following files:
|
|
5
|
+
- **calc_ast_builder.rb** containing the class `CalcASTBuilder` that creates
|
|
6
|
+
the abstract syntax trees (AST) representation for a given parse result.
|
|
7
|
+
|
|
8
|
+
- **calc_ast_nodes.rb** containing the node classes for implementing the AST.
|
|
9
|
+
The nodes have a 'interpret' method that computes of the numeric value of the
|
|
10
|
+
node.
|
|
11
|
+
|
|
12
|
+
- **calc_demo.rb** a demo command-line program.
|
|
13
|
+
It parses the expression in the command-line and outputs the numeric result
|
|
14
|
+
For more details, run the command-line: `calc_demo.rb`
|
|
15
|
+
|
|
16
|
+
- **calc_grammar.rb** implementing the class `CalcGrammar`.
|
|
17
|
+
The grammar is a list of (production) rules that specifies the syntax of math
|
|
18
|
+
expression. A little examination of the grammar will reveal interesting
|
|
19
|
+
grammar features such as:
|
|
20
|
+
* Recursive rules (e.g. terminal in left-side of rule also appears in right-hand side)
|
|
21
|
+
|
|
22
|
+
- **calc_lexer.rb** implementing the class `CalcLexer`.
|
|
23
|
+
The purpose of the lexer is to break the math expression into a sequence of tokens.
|
|
24
|
+
|
|
25
|
+
- **calc_parser.rb** implementing a `CalcParser` class.
|
|
26
|
+
The parser processes the tokens stream from the lexer and delivers its results
|