Skip to content

Commit c8d5236

Browse files
byrootetiennebarrie
andcommitted
Refactor JSON::Ext::Parser to split configuration and parsing state
Ref: #718 The existing `Parser` interface is pretty bad, as it forces to instantiate a new instance for each document. Instead it's preferable to only take the config and do all the initialization needed, and then keep the parsing state on the stack on in ephemeral memory. This refactor makes the `JSON::Coder` pull request much easier to implement in a performant way. Co-Authored-By: Étienne Barrié <[email protected]>
1 parent 8c352e3 commit c8d5236

File tree

9 files changed

+591
-845
lines changed

9 files changed

+591
-845
lines changed

Rakefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ EXT_GENERATOR_DL = "#{EXT_GENERATOR_DIR}/generator.#{CONFIG['DLEXT']}"
4040
EXT_GENERATOR_SRC = "#{EXT_GENERATOR_DIR}/generator.c"
4141

4242
JAVA_DIR = "java/src/json/ext"
43-
JAVA_RAGEL_PATH = "#{JAVA_DIR}/Parser.rl"
44-
JAVA_PARSER_SRC = "#{JAVA_DIR}/Parser.java"
43+
JAVA_RAGEL_PATH = "#{JAVA_DIR}/ParserConfig.rl"
44+
JAVA_PARSER_SRC = "#{JAVA_DIR}/ParserConfig.java"
4545
JAVA_SOURCES = FileList["#{JAVA_DIR}/*.java"]
4646
JAVA_CLASSES = []
4747
JRUBY_PARSER_JAR = File.expand_path("lib/json/ext/parser.jar")
@@ -95,9 +95,9 @@ end
9595
file JAVA_PARSER_SRC => JAVA_RAGEL_PATH do
9696
cd JAVA_DIR do
9797
if RAGEL_CODEGEN == 'ragel'
98-
sh "ragel Parser.rl -J -o Parser.java"
98+
sh "ragel ParserConfig.rl -J -o ParserConfig.java"
9999
else
100-
sh "ragel -x Parser.rl | #{RAGEL_CODEGEN} -J"
100+
sh "ragel -x ParserConfig.rl | #{RAGEL_CODEGEN} -J"
101101
end
102102
end
103103
end

0 commit comments

Comments
 (0)