iparser 1.1.2 → 1.1.3
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/README.md +7 -5
- data/lib/iparser/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0106d75e819c43af7da5c282d661c29a5c90e8ea
|
4
|
+
data.tar.gz: 1cebe402197c60e390f477b5d9331c70ea8f520b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1464526b0c4670428996b7dde12b96366dba8a27c9fa7a701265313904d4f0c97193338cf6f058b0a65dddae73eeea8e11cc4534db8c249c372d4978d15537a0
|
7
|
+
data.tar.gz: 5ecbdd4e9ad9f5a494ff109b816f2bf5290e5dc6d8b3882b18ce74a4304d3f856d524ff0075e0ca7032114bbba5ad90d1a71b4f2dc86064b07a00d6699bd6e01
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@ Used for simple and fast create your specific parsers.
|
|
8
8
|
Add this line to your application's Gemfile:
|
9
9
|
|
10
10
|
```ruby
|
11
|
-
gem '
|
11
|
+
gem 'Iparser'
|
12
12
|
```
|
13
13
|
|
14
14
|
And then execute:
|
@@ -17,7 +17,7 @@ And then execute:
|
|
17
17
|
|
18
18
|
Or install it yourself as:
|
19
19
|
|
20
|
-
$ gem install
|
20
|
+
$ gem install iparser
|
21
21
|
|
22
22
|
## Usage
|
23
23
|
|
@@ -25,6 +25,8 @@ For example usage, present here very simple parser for automatically generate do
|
|
25
25
|
|
26
26
|
*source № 1*:
|
27
27
|
```ruby
|
28
|
+
require 'iparser'
|
29
|
+
|
28
30
|
#
|
29
31
|
# Create parser-machine object.
|
30
32
|
#
|
@@ -80,7 +82,7 @@ parser.interactive_parser
|
|
80
82
|
```
|
81
83
|
|
82
84
|
Run this script and typing `'///'` for branch to 'comment-line' state. Then type `'\n'` or `'\r'` for leave this state.
|
83
|
-
**NOTE**: Type `'\\'` for input `'\'`. Check each state. Press
|
85
|
+
**NOTE**: Type `'\\'` for input `'\'`. Check each state. Press `enter` (input empty string) to leave interactive mode.
|
84
86
|
After successfully check, add the following code to the beginning of the file:
|
85
87
|
|
86
88
|
*source № 2*:
|
@@ -126,7 +128,7 @@ Handler may be return following data types: `Fixnum` - index to branch (>=0),
|
|
126
128
|
`NilClass` - hold current state (nil) and any data types for break parse (error, method `parse`
|
127
129
|
return `false`).
|
128
130
|
|
129
|
-
For `comment-block` state set ignore char -
|
131
|
+
For `comment-block` state set ignore char - `*`, and handler don't called to this chars.
|
130
132
|
|
131
133
|
Add the following code instead `parser.interactive_parser`:
|
132
134
|
|
@@ -317,7 +319,7 @@ After work, we should see a file named 'index.html'.
|
|
317
319
|
о том, что парсер перешол в состояние для обработки однострочных комментариев, т.е. в состояние `comment-line`.
|
318
320
|
Теперь введем `\n` или `\r` и увидим что парсер покинул состояние `comment-line` и вернулся в состояние `idle`.
|
319
321
|
Аналогично проведем проверку для всех оставшихся состояний. Для выхода из интерактивного режима просто введите
|
320
|
-
|
322
|
+
`Enter`, т.е. пустую строку.
|
321
323
|
|
322
324
|
**NOTE**: для ввода символа `'\'` необходимо набрать `'\\'`.
|
323
325
|
|
data/lib/iparser/version.rb
CHANGED