rparsec2 1.1.0 → 1.2.1
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/lib/rparsec/context.rb +80 -78
- data/lib/rparsec/error.rb +21 -18
- data/lib/rparsec/expressions.rb +75 -163
- data/lib/rparsec/functor_mixin.rb +102 -0
- data/lib/rparsec/functors.rb +151 -255
- data/lib/rparsec/id_monad.rb +13 -11
- data/lib/rparsec/keywords.rb +95 -93
- data/lib/rparsec/locator.rb +27 -25
- data/lib/rparsec/misc.rb +14 -97
- data/lib/rparsec/monad.rb +53 -50
- data/lib/rparsec/operator_table.rb +89 -0
- data/lib/rparsec/operators.rb +85 -81
- data/lib/rparsec/parser.rb +397 -819
- data/lib/rparsec/parser_monad.rb +18 -16
- data/lib/rparsec/parsers.rb +922 -499
- data/lib/rparsec/token.rb +32 -30
- data/lib/rparsec.rb +7 -4
- metadata +11 -3
data/lib/rparsec/token.rb
CHANGED
@@ -1,43 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'rparsec/misc'
|
2
4
|
|
3
5
|
module RParsec
|
4
6
|
|
5
|
-
#
|
6
|
-
# Represents a token during lexical analysis.
|
7
|
-
#
|
8
|
-
class Token
|
9
|
-
extend DefHelper
|
10
|
-
|
11
|
-
def_ctor :kind, :text, :index
|
12
|
-
|
13
7
|
#
|
14
|
-
#
|
8
|
+
# Represents a token during lexical analysis.
|
15
9
|
#
|
16
|
-
|
10
|
+
class Token
|
11
|
+
extend DefHelper
|
17
12
|
|
18
|
-
|
19
|
-
# The text of the matched range
|
20
|
-
#
|
21
|
-
attr_reader :text
|
13
|
+
def_ctor :kind, :text, :index
|
22
14
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
15
|
+
#
|
16
|
+
# The type of the token
|
17
|
+
#
|
18
|
+
attr_reader :kind
|
27
19
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
@text.length
|
33
|
-
end
|
20
|
+
#
|
21
|
+
# The text of the matched range
|
22
|
+
#
|
23
|
+
attr_reader :text
|
34
24
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
25
|
+
#
|
26
|
+
# The starting index of the matched range
|
27
|
+
#
|
28
|
+
attr_reader :index
|
29
|
+
|
30
|
+
#
|
31
|
+
# The length of the token.
|
32
|
+
#
|
33
|
+
def length
|
34
|
+
@text.length
|
35
|
+
end
|
36
|
+
|
37
|
+
#
|
38
|
+
# String representation of the token.
|
39
|
+
#
|
40
|
+
def to_s
|
41
|
+
"#{@kind}: #{@text}"
|
42
|
+
end
|
40
43
|
end
|
41
|
-
end
|
42
44
|
|
43
45
|
end # module
|
data/lib/rparsec.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rparsec/parsers"
|
4
|
+
require "rparsec/operators"
|
5
|
+
require "rparsec/keywords"
|
6
|
+
require "rparsec/expressions"
|
4
7
|
|
5
8
|
module RParsec
|
6
|
-
VERSION = "1.1
|
9
|
+
VERSION = "1.2.1"
|
7
10
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rparsec2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Yu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-11-
|
11
|
+
date: 2024-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: rparsec is a recursive descent parser combinator framework. Declarative
|
14
14
|
API allows creating parser intuitively and dynamically.
|
@@ -21,22 +21,30 @@ files:
|
|
21
21
|
- lib/rparsec/context.rb
|
22
22
|
- lib/rparsec/error.rb
|
23
23
|
- lib/rparsec/expressions.rb
|
24
|
+
- lib/rparsec/functor_mixin.rb
|
24
25
|
- lib/rparsec/functors.rb
|
25
26
|
- lib/rparsec/id_monad.rb
|
26
27
|
- lib/rparsec/keywords.rb
|
27
28
|
- lib/rparsec/locator.rb
|
28
29
|
- lib/rparsec/misc.rb
|
29
30
|
- lib/rparsec/monad.rb
|
31
|
+
- lib/rparsec/operator_table.rb
|
30
32
|
- lib/rparsec/operators.rb
|
31
33
|
- lib/rparsec/parser.rb
|
32
34
|
- lib/rparsec/parser_monad.rb
|
33
35
|
- lib/rparsec/parsers.rb
|
34
36
|
- lib/rparsec/token.rb
|
35
|
-
homepage:
|
37
|
+
homepage: https://git.disroot.org/gemmaro/rparsec2
|
36
38
|
licenses:
|
37
39
|
- BSD-3-Clause
|
38
40
|
metadata:
|
39
41
|
rubygems_mfa_required: 'true'
|
42
|
+
bug_tracker_uri: https://git.disroot.org/gemmaro/rparsec2/issues
|
43
|
+
changelog_uri: https://git.disroot.org/gemmaro/rparsec2/src/branch/main/CHANGELOG.md
|
44
|
+
documentation_uri: https://gemmaro.github.io/rparsec2
|
45
|
+
homepage_uri: https://git.disroot.org/gemmaro/rparsec2
|
46
|
+
source_code_uri: https://git.disroot.org/gemmaro/rparsec2
|
47
|
+
wiki_uri: https://git.disroot.org/gemmaro/rparsec2/wiki
|
40
48
|
post_install_message:
|
41
49
|
rdoc_options: []
|
42
50
|
require_paths:
|