glaemscribe 1.1.9 → 1.1.10
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/glaemresources/modes/mercian.glaem +2 -2
- data/glaemresources/modes/raw-tengwar.glaem +13 -4
- data/glaemresources/modes/westsaxon.glaem +1 -1
- data/lib/api/glaeml.rb +13 -2
- data/lib/api/glaeml_shellwords.rb +157 -0
- data/lib/glaemscribe.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c925a9a514e78b260c133356a6fb6f2c74a0604
|
4
|
+
data.tar.gz: ad4f4f17e164af4c096387babf85995f6dc9303e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34713507c8c624cdd3b98a31fc33e72b486544ab50026bd29ec608030401d1645f912059f934c91b19c7d239c4ceca9b6bc294294087d4e72f5a8c02606e1d4c
|
7
|
+
data.tar.gz: ca5d1ce433c25646d263e3afd19ac172803819a82ac98cee76cd8ecc7c2493d8fa990747832faed4db7d20bc766d4251af2f7b130b72ae945dc625c46524945f
|
@@ -131,10 +131,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
131
131
|
{LVOWELS} === {AA} * {AEAE} * {OEOE} * {EE} * {II} * {OO} * {UU} * {YY}
|
132
132
|
{LTEHTAR} === ARA A_TEHTA * ARA Y_TEHTA * ARA E_TEHTA_DOUBLE * ARA E_TEHTA * ARA I_TEHTA * ARA O_TEHTA * ARA U_TEHTA * ARA SEV_TEHTA
|
133
133
|
|
134
|
-
{LVOWEL_MARKER} ===
|
134
|
+
{LVOWEL_MARKER} === THINNAS
|
135
135
|
|
136
136
|
\** DOWN TEHTAS **\
|
137
|
-
{DTEHTAR} === A_TEHTA_INF * Y_TEHTA_INF * CIRC_TEHTA_INF * E_TEHTA_INF * I_TEHTA_INF * O_TEHTA_INF * U_TEHTA_INF *
|
137
|
+
{DTEHTAR} === A_TEHTA_INF * Y_TEHTA_INF * CIRC_TEHTA_INF * E_TEHTA_INF * I_TEHTA_INF * O_TEHTA_INF * U_TEHTA_INF * THINNAS * {NULL}
|
138
138
|
|
139
139
|
|
140
140
|
{S_VOWELS_NP} === [ {S_VOWELS_NP_KERNEL} ]
|
@@ -48,7 +48,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
48
48
|
|
49
49
|
|
50
50
|
\beg options
|
51
|
-
\beg option consonant_modification_style
|
51
|
+
\beg option consonant_modification_style CONSONANT_MODIFICATION_STYLE_WAVE
|
52
52
|
\value CONSONANT_MODIFICATION_STYLE_WAVE 0
|
53
53
|
\value CONSONANT_MODIFICATION_STYLE_BAR 1
|
54
54
|
\end
|
@@ -76,7 +76,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
76
76
|
_acirc_ --> A_TEHTA_CIRCUM
|
77
77
|
_arev_ --> A_TEHTA_REVERSED
|
78
78
|
|
79
|
-
_e_
|
79
|
+
_e_ --> E_TEHTA
|
80
|
+
_egrave_ --> E_TEHTA_GRAVE
|
81
|
+
|
82
|
+
_breve_ --> TEHTA_BREVE
|
83
|
+
|
80
84
|
_i_ --> I_TEHTA
|
81
85
|
_o_ --> O_TEHTA
|
82
86
|
_u_ --> U_TEHTA
|
@@ -88,6 +92,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
88
92
|
_u<_ --> U_TEHTA_INF
|
89
93
|
|
90
94
|
_unutixe_ --> I_TEHTA_INF
|
95
|
+
|
96
|
+
_thinnas_ --> THINNAS
|
91
97
|
|
92
98
|
_ee_ --> E_TEHTA_DOUBLE
|
93
99
|
_ii_ --> I_TEHTA_DOUBLE
|
@@ -167,13 +173,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
167
173
|
\** bearers **\
|
168
174
|
_(telco)_ --> TELCO
|
169
175
|
_(ara,ára)_ --> ARA
|
170
|
-
_(halla)_ --> HALLA
|
176
|
+
_(halla,gasdil)_ --> HALLA
|
171
177
|
|
172
178
|
\** consonant modifiers **\
|
173
179
|
_(geminate)_ --> {GEMINATE}
|
174
180
|
_(nasal)_ --> {NASAL}
|
175
181
|
_(palatal)_ --> PALATAL_SIGN
|
176
|
-
|
182
|
+
_(labial)_ --> SEV_TEHTA
|
183
|
+
|
177
184
|
_0_ --> NUM_0
|
178
185
|
_1_ --> NUM_1
|
179
186
|
_2_ --> NUM_2
|
@@ -186,6 +193,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
186
193
|
_9_ --> NUM_9
|
187
194
|
_10_ --> NUM_10
|
188
195
|
_11_ --> NUM_11
|
196
|
+
|
197
|
+
_(lsd)_ --> CIRC_TEHTA_INF
|
189
198
|
|
190
199
|
\end
|
191
200
|
|
@@ -132,7 +132,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
132
132
|
{L_TEHTAR} === ARA E_TEHTA * ARA A_TEHTA * ARA E_TEHTA_DOUBLE * ARA Y_TEHTA * ARA I_TEHTA * ARA O_TEHTA * ARA U_TEHTA * ARA SEV_TEHTA
|
133
133
|
|
134
134
|
\** DOWN TEHTAS **\
|
135
|
-
{TEHTAR_DN} === E_TEHTA_INF * A_TEHTA_INF * CIRC_TEHTA_INF * Y_TEHTA_INF * I_TEHTA_INF * TELCO O_TEHTA * TELCO U_TEHTA *
|
135
|
+
{TEHTAR_DN} === E_TEHTA_INF * A_TEHTA_INF * CIRC_TEHTA_INF * Y_TEHTA_INF * I_TEHTA_INF * TELCO O_TEHTA * TELCO U_TEHTA * THINNAS * VILYA * {NULL}
|
136
136
|
|
137
137
|
{S_VOWELS_NP} === [ {S_VOWELS_NP_KERNEL} ]
|
138
138
|
{S_VOWELS_NP_WN} === [ {S_VOWELS_NP_KERNEL} * {NULL} ]
|
data/lib/api/glaeml.rb
CHANGED
@@ -153,7 +153,12 @@ module Glaemscribe
|
|
153
153
|
@document.errors << Error.new(lnum, "Bad element name #{rest}.")
|
154
154
|
else
|
155
155
|
name = $1
|
156
|
-
|
156
|
+
begin
|
157
|
+
args = Shellwords.new.parse $'
|
158
|
+
rescue Shellwords::Error => e
|
159
|
+
@document.errors << Error.new(lnum, "Failed to parse args : #{e}")
|
160
|
+
args = []
|
161
|
+
end
|
157
162
|
end
|
158
163
|
|
159
164
|
n = Node.new(lnum, Node::Type::ElementBlock, name)
|
@@ -179,7 +184,13 @@ module Glaemscribe
|
|
179
184
|
l = l[1..-1]
|
180
185
|
l =~ /^([a-z_]+)/
|
181
186
|
name = $1
|
182
|
-
|
187
|
+
|
188
|
+
begin
|
189
|
+
args = Shellwords.new.parse $'
|
190
|
+
rescue Shellwords::Error => e
|
191
|
+
@document.errors << Error.new(lnum, "Failed to parse args : #{e}")
|
192
|
+
args = []
|
193
|
+
end
|
183
194
|
|
184
195
|
n = Node.new(lnum, Node::Type::ElementInline, name)
|
185
196
|
n.args += args
|
@@ -0,0 +1,157 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
#
|
3
|
+
# Glǽmscribe (also written Glaemscribe) is a software dedicated to
|
4
|
+
# the transcription of texts between writing systems, and more
|
5
|
+
# specifically dedicated to the transcription of J.R.R. Tolkien's
|
6
|
+
# invented languages to some of his devised writing systems.
|
7
|
+
#
|
8
|
+
# Copyright (C) 2015 Benjamin Babut (Talagan).
|
9
|
+
#
|
10
|
+
# This program is free software: you can redistribute it and/or modify
|
11
|
+
# it under the terms of the GNU Affero General Public License as published by
|
12
|
+
# the Free Software Foundation, either version 3 of the License, or
|
13
|
+
# any later version.
|
14
|
+
#
|
15
|
+
# This program is distributed in the hope that it will be useful,
|
16
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18
|
+
# GNU Affero General Public License for more details.
|
19
|
+
#
|
20
|
+
# You should have received a copy of the GNU Affero General Public License
|
21
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
22
|
+
|
23
|
+
module Glaemscribe
|
24
|
+
module API
|
25
|
+
module Glaeml
|
26
|
+
class Shellwords
|
27
|
+
|
28
|
+
class Error < StandardError
|
29
|
+
end
|
30
|
+
|
31
|
+
def initialize
|
32
|
+
end
|
33
|
+
|
34
|
+
ESCAPE_MODE_UNICODE = 1
|
35
|
+
|
36
|
+
def reset_state
|
37
|
+
@is_escaping = false
|
38
|
+
@is_eating_arg = false
|
39
|
+
@is_eating_arg_between_quotes = false
|
40
|
+
@args = []
|
41
|
+
@current_arg = ""
|
42
|
+
|
43
|
+
@escape_mode = nil
|
44
|
+
@unicode_escape_counter = 0
|
45
|
+
@unicode_escape_str = ''
|
46
|
+
end
|
47
|
+
|
48
|
+
def advance_inside_arg(l,i)
|
49
|
+
if l[i] == "\\"
|
50
|
+
@is_escaping = true
|
51
|
+
@escape_mode = nil
|
52
|
+
else
|
53
|
+
@current_arg += l[i]
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def advance_inside_escape(l,i)
|
58
|
+
if !@escape_mode
|
59
|
+
# We don't now yet what to do.
|
60
|
+
case l[i]
|
61
|
+
when 'n'
|
62
|
+
@current_arg << "\n"
|
63
|
+
@is_escaping = false
|
64
|
+
return
|
65
|
+
when "\\"
|
66
|
+
@current_arg << "\\"
|
67
|
+
@is_escaping = false
|
68
|
+
when 't'
|
69
|
+
@current_arg << "\t"
|
70
|
+
@is_escaping = false
|
71
|
+
when "\""
|
72
|
+
@current_arg << "\""
|
73
|
+
@is_escaping = false
|
74
|
+
when "u"
|
75
|
+
@escape_mode = ESCAPE_MODE_UNICODE
|
76
|
+
@unicode_escape_counter = 0
|
77
|
+
@unicode_escape_str = ''
|
78
|
+
else
|
79
|
+
raise Error, "Unknown escapment : \\#{l[i]}"
|
80
|
+
end
|
81
|
+
else
|
82
|
+
case @escape_mode
|
83
|
+
when ESCAPE_MODE_UNICODE
|
84
|
+
c = l[i].downcase
|
85
|
+
|
86
|
+
if !(c =~ /[0-9a-f]/)
|
87
|
+
raise Error, 'Wrong format for unicode escaping, should be \u with 4 hex digits'
|
88
|
+
end
|
89
|
+
|
90
|
+
@unicode_escape_counter += 1
|
91
|
+
@unicode_escape_str += c
|
92
|
+
if @unicode_escape_counter == 4
|
93
|
+
@is_escaping = false
|
94
|
+
@current_arg += [@unicode_escape_str.hex].pack("U")
|
95
|
+
end
|
96
|
+
|
97
|
+
else
|
98
|
+
raise Error, "Unimplemented escape mode"
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
103
|
+
|
104
|
+
def parse(l)
|
105
|
+
reset_state
|
106
|
+
|
107
|
+
i = 0
|
108
|
+
l.length.times{ |i|
|
109
|
+
|
110
|
+
if !@is_eating_arg
|
111
|
+
next if l[i] =~ /\s/
|
112
|
+
@is_eating_arg = true
|
113
|
+
@is_eating_arg_between_quotes = (l[i] == "\"")
|
114
|
+
@current_arg << l[i] if !@is_eating_arg_between_quotes
|
115
|
+
else
|
116
|
+
# Eating arg
|
117
|
+
if @is_escaping
|
118
|
+
advance_inside_escape(l,i)
|
119
|
+
else
|
120
|
+
if !@is_eating_arg_between_quotes
|
121
|
+
if l[i] =~ /[\s"]/
|
122
|
+
@args << @current_arg
|
123
|
+
@current_arg = ""
|
124
|
+
@is_eating_arg = (l[i] == "\"") # Starting a new arg directly
|
125
|
+
@is_eating_arg_between_quotes = @is_eating_arg
|
126
|
+
next
|
127
|
+
else
|
128
|
+
advance_inside_arg(l,i)
|
129
|
+
end
|
130
|
+
else
|
131
|
+
if l[i] == "\""
|
132
|
+
@args << @current_arg
|
133
|
+
@current_arg = ""
|
134
|
+
@is_eating_arg = false
|
135
|
+
else
|
136
|
+
advance_inside_arg(l,i)
|
137
|
+
end
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
}
|
142
|
+
|
143
|
+
if @is_eating_arg && @is_eating_arg_between_quotes
|
144
|
+
raise Error, "Unmatched quote."
|
145
|
+
end
|
146
|
+
|
147
|
+
@args << @current_arg if !@current_arg.empty?
|
148
|
+
|
149
|
+
@args
|
150
|
+
end
|
151
|
+
|
152
|
+
end
|
153
|
+
end
|
154
|
+
end
|
155
|
+
end
|
156
|
+
|
157
|
+
|
data/lib/glaemscribe.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glaemscribe
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Benjamin 'Talagan' Babut
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: commander
|
@@ -75,6 +75,7 @@ files:
|
|
75
75
|
- lib/api/eval.rb
|
76
76
|
- lib/api/fragment.rb
|
77
77
|
- lib/api/glaeml.rb
|
78
|
+
- lib/api/glaeml_shellwords.rb
|
78
79
|
- lib/api/if_tree.rb
|
79
80
|
- lib/api/mode.rb
|
80
81
|
- lib/api/mode_parser.rb
|