expressir 1.2.3 → 1.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/rake.yml +30 -17
  3. data/.gitignore +1 -0
  4. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/CMakeLists.txt +30 -5
  5. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlr4cpp-vs2019.vcxproj +8 -0
  6. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/project.pbxproj +31 -15
  7. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4.xcscheme +1 -1
  8. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4_ios.xcscheme +1 -5
  9. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/antlrcpp.xcodeproj/xcshareddata/xcschemes/antlr4_static.xcscheme +1 -5
  10. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.cpp +1 -6
  11. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRFileStream.h +9 -6
  12. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.cpp +26 -12
  13. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ANTLRInputStream.h +10 -3
  14. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.cpp +1 -1
  15. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/CommonTokenFactory.h +1 -1
  16. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/IntStream.h +7 -1
  17. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.cpp +2 -2
  18. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Lexer.h +23 -10
  19. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.cpp +2 -2
  20. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ListTokenSource.h +2 -2
  21. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.cpp +4 -4
  22. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Parser.h +1 -1
  23. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.cpp +3 -3
  24. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ParserRuleContext.h +1 -1
  25. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/ProxyErrorListener.cpp +4 -4
  26. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Recognizer.h +8 -2
  27. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/RuntimeMetaData.cpp +1 -1
  28. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Token.h +39 -7
  29. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenSource.h +1 -1
  30. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.cpp +5 -5
  31. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/TokenStreamRewriter.h +9 -2
  32. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.cpp +11 -19
  33. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/Vocabulary.h +2 -3
  34. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/antlr4-common.h +4 -1
  35. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.cpp +2 -2
  36. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATN.h +7 -1
  37. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.cpp +0 -2
  38. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNConfig.h +8 -2
  39. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.cpp +0 -2
  40. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNDeserializer.h +7 -1
  41. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNSerializer.cpp +1 -1
  42. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.cpp +1 -1
  43. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ATNState.h +9 -2
  44. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.cpp +8 -10
  45. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LL1Analyzer.h +7 -1
  46. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/LexerATNSimulator.h +9 -2
  47. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/ParserATNSimulator.cpp +6 -2
  48. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/atn/PredictionContext.h +14 -2
  49. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFA.cpp +2 -2
  50. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFASerializer.cpp +1 -1
  51. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/dfa/DFAState.cpp +1 -1
  52. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/IntervalSet.cpp +9 -9
  53. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/misc/MurmurHash.h +7 -1
  54. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Any.h +1 -1
  55. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/Arrays.cpp +2 -2
  56. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/CPPUtils.cpp +1 -1
  57. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.cpp +11 -1
  58. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/support/StringUtils.h +40 -18
  59. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTree.h +1 -1
  60. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/ParseTreeWalker.h +29 -5
  61. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/Trees.cpp +1 -1
  62. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/pattern/ParseTreePattern.cpp +1 -1
  63. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPath.cpp +1 -1
  64. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathRuleElement.cpp +1 -1
  65. data/ext/express-parser/antlr4-upstream/runtime/Cpp/runtime/src/tree/xpath/XPathTokenElement.cpp +1 -1
  66. data/ext/express-parser/express_parser.cpp +20 -164
  67. data/ext/express-parser/extconf.rb +3 -4
  68. data/lib/expressir/express/parser.rb +17 -14
  69. data/lib/expressir/express/visitor.rb +3 -1
  70. data/lib/expressir/version.rb +1 -1
  71. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ed22396a4091ea7d3a8566db42a74806abfc53fae2af66bdac4c2a0dc76080cb
4
- data.tar.gz: 15b525668cbd513ec35e17e3ff73971923db791ecb1bab098a9d085440b8daf7
3
+ metadata.gz: b49995be8d03fa2c3645c2eb017616799cc53a79adad902c86b816d498f32b4e
4
+ data.tar.gz: 2ecd3927758f4e326d72f46b8ca7eac0e1532d732ad475c28bd49acf4bd23d92
5
5
  SHA512:
6
- metadata.gz: f2629d400d4d0892e79a3ae66693ae737b01d9234a585ee2ec40bc9be6a15c7de8c28698fefc6d9b78f65d50d730435e74fd3b4ac52b5d573a7b927931ffa4bf
7
- data.tar.gz: 8956af3892298332b0f4c8b27ca2bbaf1132f199dc6216d7a66f35fcee3d13ad429ff514bc6fecd97acf4b11e0f07547359f335b4f3389b13014b89d83650129
6
+ metadata.gz: 801cf8165883e10e1b4c5d7adfe53d8ae71206386e788de0df2b7b7b9fdb05a92dba578e4e5728cf55650039cced0d0f6b14cf8cd8966a896beca097ae3e8844
7
+ data.tar.gz: 59766ae40419522f4d9bbe16389a145e8967f15746475de92096e62cae5f518205d52b8c6b833bf3035e1daf041d1f6032244f5f3e3a967bc2a34f95c70030a3
@@ -8,7 +8,7 @@ on:
8
8
  jobs:
9
9
  rake:
10
10
  name: test on ruby-${{ matrix.ruby }} ${{ matrix.os }}
11
- runs-on: ${{ matrix.os }}
11
+ runs-on: ${{ matrix.os }}
12
12
  continue-on-error: ${{ matrix.experimental }}
13
13
  strategy:
14
14
  fail-fast: false
@@ -28,52 +28,64 @@ jobs:
28
28
  experimental: true
29
29
 
30
30
  steps:
31
- - uses: actions/checkout@v2
31
+ - name: Checkout
32
+ uses: actions/checkout@v2
32
33
  with:
33
34
  submodules: recursive
34
35
 
35
- - if: matrix.os == 'macos-latest'
36
+ - name: Setup packages
37
+ if: startsWith(matrix.os, 'macos')
36
38
  run: brew install autoconf automake libtool
37
39
 
38
- - uses: ruby/setup-ruby@v1
40
+ - name: Install Ruby
41
+ uses: ruby/setup-ruby@v1
39
42
  with:
40
43
  ruby-version: ${{ matrix.ruby }}
41
44
  bundler-cache: true
42
45
 
43
- - uses: actions/cache@v2
46
+ - name: Process cache
47
+ uses: actions/cache@v2
48
+ id: cache
44
49
  with:
45
50
  path: lib/expressir/express/express_parser.*
46
51
  key: v4-${{ runner.os }}-${{ matrix.ruby }}-${{ hashFiles('ext/express-parser/extconf.rb', 'ext/express-parser/antlrgen/**', 'ext/express-parser/express_parser.cpp', '.git/modules/ext/express-parser/antlr4-upstream/HEAD') }}
47
52
 
48
- - if: hashFiles('lib/expressir/express/express_parser.*') == ''
53
+ - name: Build native extension
54
+ if: steps.cache.outputs.cache-hit != 'true'
49
55
  run: bundle exec rake compile
50
56
 
51
- - run: bundle exec rake
57
+ - name: Run tests
58
+ run: bundle exec rake
52
59
 
53
60
  # test release workflow
54
61
  pack:
55
- runs-on: ubuntu-18.04
62
+ runs-on: ubuntu-latest
56
63
  strategy:
57
64
  fail-fast: false
58
65
  matrix:
59
66
  host: [ linux, windows, darwin ]
60
67
  steps:
61
- - uses: actions/checkout@v2
68
+ - name: Checkout
69
+ uses: actions/checkout@v2
62
70
  with:
63
71
  submodules: recursive
64
72
 
65
- - uses: ruby/setup-ruby@v1
73
+ - name: Setup Ruby
74
+ uses: ruby/setup-ruby@v1
66
75
  with:
67
76
  ruby-version: '3.0'
68
77
  # bundler-cache: true important to not use cache because it leads to "cannot find -lrice"
69
78
  # more info https://github.com/lutaml/expressir/runs/2097658383?check_suite_focus=true#step:7:2126
70
79
 
71
- - run: bundle install --jobs 4 --retry 3
80
+ - name: Bundle
81
+ run: bundle install --jobs 4 --retry 3
72
82
 
73
- # build gem WITHOUT pre-built native extension
74
- - run: gem build expressir.gemspec
83
+ - name: Build gem without native extension
84
+ if: matrix.host == 'linux'
85
+ run: gem build expressir.gemspec
75
86
 
76
- - if: matrix.host == 'linux'
87
+ - name: Package gem without native extension
88
+ if: matrix.host == 'linux'
77
89
  uses: actions/upload-artifact@v2
78
90
  with:
79
91
  name: pkg-ruby
@@ -87,10 +99,11 @@ jobs:
87
99
  sudo swapon /compile.swap
88
100
  sudo swapon --all --verbose
89
101
 
90
- # build gem WITH pre-built native extension
91
- - run: bundle exec rake gem:${{ matrix.host }}
102
+ - name: Build gem with native extension
103
+ run: bundle exec rake gem:${{ matrix.host }}
92
104
 
93
- - uses: actions/upload-artifact@v2
105
+ - name: Package gem with native extension
106
+ uses: actions/upload-artifact@v2
94
107
  with:
95
108
  name: pkg-${{ matrix.host }}
96
109
  path: pkg/*.gem
data/.gitignore CHANGED
@@ -15,3 +15,4 @@
15
15
  .rspec_status
16
16
 
17
17
  /ext/express-parser/rice-embed
18
+ /lib/expressir/express/express_parser.so
@@ -1,4 +1,19 @@
1
1
 
2
+ include(${CMAKE_ROOT}/Modules/ExternalProject.cmake)
3
+
4
+ set(THIRDPARTY_DIR ${CMAKE_BINARY_DIR}/runtime/thirdparty)
5
+ set(UTFCPP_DIR ${THIRDPARTY_DIR}/utfcpp)
6
+ ExternalProject_Add(
7
+ utfcpp
8
+ GIT_REPOSITORY "git://github.com/nemtrif/utfcpp"
9
+ GIT_TAG "v3.1.1"
10
+ SOURCE_DIR ${UTFCPP_DIR}
11
+ UPDATE_DISCONNECTED 1
12
+ CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${UTFCPP_DIR}/install -Dgtest_force_shared_crt=ON
13
+ TEST_AFTER_INSTALL 1
14
+ STEP_TARGETS build)
15
+
16
+
2
17
  include_directories(
3
18
  ${PROJECT_SOURCE_DIR}/runtime/src
4
19
  ${PROJECT_SOURCE_DIR}/runtime/src/atn
@@ -8,6 +23,8 @@ include_directories(
8
23
  ${PROJECT_SOURCE_DIR}/runtime/src/tree
9
24
  ${PROJECT_SOURCE_DIR}/runtime/src/tree/pattern
10
25
  ${PROJECT_SOURCE_DIR}/runtime/src/tree/xpath
26
+ ${UTFCPP_DIR}/install/include/utf8cpp
27
+ ${UTFCPP_DIR}/install/include/utf8cpp/utf8
11
28
  )
12
29
 
13
30
 
@@ -33,8 +50,8 @@ add_custom_target(make_lib_output_dir ALL
33
50
  COMMAND ${CMAKE_COMMAND} -E make_directory ${LIB_OUTPUT_DIR}
34
51
  )
35
52
 
36
- add_dependencies(antlr4_shared make_lib_output_dir)
37
- add_dependencies(antlr4_static make_lib_output_dir)
53
+ add_dependencies(antlr4_shared make_lib_output_dir utfcpp)
54
+ add_dependencies(antlr4_static make_lib_output_dir utfcpp)
38
55
 
39
56
  if(CMAKE_SYSTEM_NAME MATCHES "Linux")
40
57
  target_link_libraries(antlr4_shared ${UUID_LIBRARIES})
@@ -102,15 +119,23 @@ set_target_properties(antlr4_static
102
119
  COMPILE_FLAGS "${disabled_compile_warnings} ${extra_static_compile_flags}")
103
120
 
104
121
  install(TARGETS antlr4_shared
105
- DESTINATION lib
122
+ DESTINATION lib
106
123
  EXPORT antlr4-targets)
107
124
  install(TARGETS antlr4_static
108
125
  DESTINATION lib
109
126
  EXPORT antlr4-targets)
110
127
 
111
- install(DIRECTORY "${PROJECT_SOURCE_DIR}/runtime/src/"
128
+ install(DIRECTORY "${PROJECT_SOURCE_DIR}/runtime/src/"
129
+ DESTINATION "include/antlr4-runtime"
130
+ COMPONENT dev
131
+ FILES_MATCHING PATTERN "*.h"
132
+ )
133
+
134
+ install(FILES "${UTFCPP_DIR}/source/utf8.h"
135
+ DESTINATION "include/antlr4-runtime")
136
+ install(DIRECTORY "${UTFCPP_DIR}/source/utf8"
112
137
  DESTINATION "include/antlr4-runtime"
113
- COMPONENT dev
138
+ COMPONENT dev
114
139
  FILES_MATCHING PATTERN "*.h"
115
140
  )
116
141
 
@@ -182,6 +182,7 @@
182
182
  <DisableSpecificWarnings>4251</DisableSpecificWarnings>
183
183
  <MultiProcessorCompilation>true</MultiProcessorCompilation>
184
184
  <MinimalRebuild>false</MinimalRebuild>
185
+ <AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
185
186
  </ClCompile>
186
187
  <Link>
187
188
  <SubSystem>Windows</SubSystem>
@@ -201,6 +202,7 @@
201
202
  <DisableSpecificWarnings>4251</DisableSpecificWarnings>
202
203
  <MultiProcessorCompilation>true</MultiProcessorCompilation>
203
204
  <MinimalRebuild>false</MinimalRebuild>
205
+ <AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
204
206
  </ClCompile>
205
207
  <Link>
206
208
  <SubSystem>Windows</SubSystem>
@@ -220,6 +222,7 @@
220
222
  <DisableSpecificWarnings>4251</DisableSpecificWarnings>
221
223
  <MultiProcessorCompilation>true</MultiProcessorCompilation>
222
224
  <MinimalRebuild>false</MinimalRebuild>
225
+ <AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
223
226
  </ClCompile>
224
227
  <Link>
225
228
  <SubSystem>Windows</SubSystem>
@@ -239,6 +242,7 @@
239
242
  <DisableSpecificWarnings>4251</DisableSpecificWarnings>
240
243
  <MultiProcessorCompilation>true</MultiProcessorCompilation>
241
244
  <MinimalRebuild>false</MinimalRebuild>
245
+ <AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
242
246
  </ClCompile>
243
247
  <Link>
244
248
  <SubSystem>Windows</SubSystem>
@@ -259,6 +263,7 @@
259
263
  </ForcedIncludeFiles>
260
264
  <DisableSpecificWarnings>4251</DisableSpecificWarnings>
261
265
  <MultiProcessorCompilation>true</MultiProcessorCompilation>
266
+ <AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
262
267
  </ClCompile>
263
268
  <Link>
264
269
  <SubSystem>Windows</SubSystem>
@@ -281,6 +286,7 @@
281
286
  </ForcedIncludeFiles>
282
287
  <DisableSpecificWarnings>4251</DisableSpecificWarnings>
283
288
  <MultiProcessorCompilation>true</MultiProcessorCompilation>
289
+ <AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
284
290
  </ClCompile>
285
291
  <Link>
286
292
  <SubSystem>Windows</SubSystem>
@@ -303,6 +309,7 @@
303
309
  </ForcedIncludeFiles>
304
310
  <DisableSpecificWarnings>4251</DisableSpecificWarnings>
305
311
  <MultiProcessorCompilation>true</MultiProcessorCompilation>
312
+ <AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
306
313
  </ClCompile>
307
314
  <Link>
308
315
  <SubSystem>Windows</SubSystem>
@@ -325,6 +332,7 @@
325
332
  </ForcedIncludeFiles>
326
333
  <DisableSpecificWarnings>4251</DisableSpecificWarnings>
327
334
  <MultiProcessorCompilation>true</MultiProcessorCompilation>
335
+ <AdditionalOptions>/Zc:__cplusplus %(AdditionalOptions)</AdditionalOptions>
328
336
  </ClCompile>
329
337
  <Link>
330
338
  <SubSystem>Windows</SubSystem>
@@ -3,7 +3,7 @@
3
3
  archiveVersion = 1;
4
4
  classes = {
5
5
  };
6
- objectVersion = 46;
6
+ objectVersion = 54;
7
7
  objects = {
8
8
 
9
9
  /* Begin PBXBuildFile section */
@@ -2226,7 +2226,7 @@
2226
2226
  37D727A21867AF1E007B6D10 /* Project object */ = {
2227
2227
  isa = PBXProject;
2228
2228
  attributes = {
2229
- LastUpgradeCheck = 1030;
2229
+ LastUpgradeCheck = 1240;
2230
2230
  ORGANIZATIONNAME = ANTLR;
2231
2231
  TargetAttributes = {
2232
2232
  270C67EF1CDB4F1E00116E17 = {
@@ -2238,7 +2238,7 @@
2238
2238
  };
2239
2239
  };
2240
2240
  buildConfigurationList = 37D727A51867AF1E007B6D10 /* Build configuration list for PBXProject "antlrcpp" */;
2241
- compatibilityVersion = "Xcode 3.2";
2241
+ compatibilityVersion = "Xcode 12.0";
2242
2242
  developmentRegion = en;
2243
2243
  hasScannedForEncodings = 0;
2244
2244
  knownRegions = (
@@ -2751,8 +2751,12 @@
2751
2751
  GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
2752
2752
  INFOPLIST_FILE = "antlrcpp-ios/Info.plist";
2753
2753
  INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
2754
- IPHONEOS_DEPLOYMENT_TARGET = 9.3;
2755
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
2754
+ IPHONEOS_DEPLOYMENT_TARGET = 12.0;
2755
+ LD_RUNPATH_SEARCH_PATHS = (
2756
+ "$(inherited)",
2757
+ "@executable_path/Frameworks",
2758
+ "@loader_path/Frameworks",
2759
+ );
2756
2760
  MTL_ENABLE_DEBUG_INFO = YES;
2757
2761
  PRODUCT_BUNDLE_IDENTIFIER = "org.antlr.v4.runtime.antlrcpp-ios";
2758
2762
  PRODUCT_NAME = "$(TARGET_NAME)";
@@ -2782,8 +2786,12 @@
2782
2786
  GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
2783
2787
  INFOPLIST_FILE = "antlrcpp-ios/Info.plist";
2784
2788
  INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
2785
- IPHONEOS_DEPLOYMENT_TARGET = 9.3;
2786
- LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
2789
+ IPHONEOS_DEPLOYMENT_TARGET = 12.0;
2790
+ LD_RUNPATH_SEARCH_PATHS = (
2791
+ "$(inherited)",
2792
+ "@executable_path/Frameworks",
2793
+ "@loader_path/Frameworks",
2794
+ );
2787
2795
  MTL_ENABLE_DEBUG_INFO = NO;
2788
2796
  PRODUCT_BUNDLE_IDENTIFIER = "org.antlr.v4.runtime.antlrcpp-ios";
2789
2797
  PRODUCT_NAME = "$(TARGET_NAME)";
@@ -2841,8 +2849,7 @@
2841
2849
  buildSettings = {
2842
2850
  ALWAYS_SEARCH_USER_PATHS = NO;
2843
2851
  CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
2844
- CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
2845
- CLANG_CXX_LIBRARY = "libc++";
2852
+ CLANG_CXX_LANGUAGE_STANDARD = "c++17";
2846
2853
  CLANG_ENABLE_OBJC_ARC = YES;
2847
2854
  CLANG_WARN_ASSIGN_ENUM = YES;
2848
2855
  CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
@@ -2857,6 +2864,7 @@
2857
2864
  CLANG_WARN_INT_CONVERSION = YES;
2858
2865
  CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
2859
2866
  CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
2867
+ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
2860
2868
  CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
2861
2869
  CLANG_WARN_STRICT_PROTOTYPES = YES;
2862
2870
  CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
@@ -2889,8 +2897,12 @@
2889
2897
  GCC_WARN_UNUSED_LABEL = YES;
2890
2898
  GCC_WARN_UNUSED_PARAMETER = YES;
2891
2899
  GCC_WARN_UNUSED_VARIABLE = YES;
2892
- HEADER_SEARCH_PATHS = src/;
2893
- MACOSX_DEPLOYMENT_TARGET = 10.9;
2900
+ HEADER_SEARCH_PATHS = (
2901
+ src/,
2902
+ thirdparty/utfcpp/source/,
2903
+ thirdparty/utfcpp/source/utf8/,
2904
+ );
2905
+ MACOSX_DEPLOYMENT_TARGET = 11.1;
2894
2906
  ONLY_ACTIVE_ARCH = YES;
2895
2907
  SDKROOT = macosx;
2896
2908
  };
@@ -2901,8 +2913,7 @@
2901
2913
  buildSettings = {
2902
2914
  ALWAYS_SEARCH_USER_PATHS = NO;
2903
2915
  CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
2904
- CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
2905
- CLANG_CXX_LIBRARY = "libc++";
2916
+ CLANG_CXX_LANGUAGE_STANDARD = "c++17";
2906
2917
  CLANG_ENABLE_OBJC_ARC = YES;
2907
2918
  CLANG_WARN_ASSIGN_ENUM = YES;
2908
2919
  CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
@@ -2917,6 +2928,7 @@
2917
2928
  CLANG_WARN_INT_CONVERSION = YES;
2918
2929
  CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
2919
2930
  CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
2931
+ CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
2920
2932
  CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
2921
2933
  CLANG_WARN_STRICT_PROTOTYPES = YES;
2922
2934
  CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES;
@@ -2945,8 +2957,12 @@
2945
2957
  GCC_WARN_UNUSED_LABEL = YES;
2946
2958
  GCC_WARN_UNUSED_PARAMETER = YES;
2947
2959
  GCC_WARN_UNUSED_VARIABLE = YES;
2948
- HEADER_SEARCH_PATHS = src/;
2949
- MACOSX_DEPLOYMENT_TARGET = 10.9;
2960
+ HEADER_SEARCH_PATHS = (
2961
+ src/,
2962
+ thirdparty/utfcpp/source/,
2963
+ thirdparty/utfcpp/source/utf8/,
2964
+ );
2965
+ MACOSX_DEPLOYMENT_TARGET = 11.1;
2950
2966
  SDKROOT = macosx;
2951
2967
  };
2952
2968
  name = Release;
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <Scheme
3
- LastUpgradeVersion = "1030"
3
+ LastUpgradeVersion = "1240"
4
4
  version = "1.3">
5
5
  <BuildAction
6
6
  parallelizeBuildables = "YES"
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <Scheme
3
- LastUpgradeVersion = "1030"
3
+ LastUpgradeVersion = "1240"
4
4
  version = "1.3">
5
5
  <BuildAction
6
6
  parallelizeBuildables = "YES"
@@ -29,8 +29,6 @@
29
29
  shouldUseLaunchSchemeArgsEnv = "YES">
30
30
  <Testables>
31
31
  </Testables>
32
- <AdditionalOptions>
33
- </AdditionalOptions>
34
32
  </TestAction>
35
33
  <LaunchAction
36
34
  buildConfiguration = "Debug"
@@ -51,8 +49,6 @@
51
49
  ReferencedContainer = "container:antlrcpp.xcodeproj">
52
50
  </BuildableReference>
53
51
  </MacroExpansion>
54
- <AdditionalOptions>
55
- </AdditionalOptions>
56
52
  </LaunchAction>
57
53
  <ProfileAction
58
54
  buildConfiguration = "Release"
@@ -1,6 +1,6 @@
1
1
  <?xml version="1.0" encoding="UTF-8"?>
2
2
  <Scheme
3
- LastUpgradeVersion = "1030"
3
+ LastUpgradeVersion = "1240"
4
4
  version = "1.3">
5
5
  <BuildAction
6
6
  parallelizeBuildables = "YES"
@@ -29,8 +29,6 @@
29
29
  shouldUseLaunchSchemeArgsEnv = "YES">
30
30
  <Testables>
31
31
  </Testables>
32
- <AdditionalOptions>
33
- </AdditionalOptions>
34
32
  </TestAction>
35
33
  <LaunchAction
36
34
  buildConfiguration = "Debug"
@@ -51,8 +49,6 @@
51
49
  ReferencedContainer = "container:antlrcpp.xcodeproj">
52
50
  </BuildableReference>
53
51
  </MacroExpansion>
54
- <AdditionalOptions>
55
- </AdditionalOptions>
56
52
  </LaunchAction>
57
53
  <ProfileAction
58
54
  buildConfiguration = "Release"
@@ -1,4 +1,4 @@
1
- /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
1
+ /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
2
2
  * Use of this file is governed by the BSD 3-clause license that
3
3
  * can be found in the LICENSE.txt file in the project root.
4
4
  */
@@ -9,11 +9,6 @@
9
9
 
10
10
  using namespace antlr4;
11
11
 
12
- ANTLRFileStream::ANTLRFileStream(const std::string &fileName) {
13
- _fileName = fileName;
14
- loadFromFile(fileName);
15
- }
16
-
17
12
  void ANTLRFileStream::loadFromFile(const std::string &fileName) {
18
13
  _fileName = fileName;
19
14
  if (_fileName.empty()) {
@@ -1,4 +1,4 @@
1
- /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
1
+ /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
2
2
  * Use of this file is governed by the BSD 3-clause license that
3
3
  * can be found in the LICENSE.txt file in the project root.
4
4
  */
@@ -13,15 +13,18 @@ namespace antlr4 {
13
13
  /// when you construct the object (or call load()).
14
14
  // TODO: this class needs testing.
15
15
  class ANTLR4CPP_PUBLIC ANTLRFileStream : public ANTLRInputStream {
16
- protected:
17
- std::string _fileName; // UTF-8 encoded file name.
18
-
19
16
  public:
20
- // Assumes a file name encoded in UTF-8 and file content in the same encoding (with or w/o BOM).
21
- ANTLRFileStream(const std::string &fileName);
17
+ ANTLRFileStream() = default;
18
+ ANTLRFileStream(const std::string &) = delete;
19
+ ANTLRFileStream(const char *data, size_t length) = delete;
20
+ ANTLRFileStream(std::istream &stream) = delete;
22
21
 
22
+ // Assumes a file name encoded in UTF-8 and file content in the same encoding (with or w/o BOM).
23
23
  virtual void loadFromFile(const std::string &fileName);
24
24
  virtual std::string getSourceName() const override;
25
+
26
+ private:
27
+ std::string _fileName; // UTF-8 encoded file name.
25
28
  };
26
29
 
27
30
  } // namespace antlr4
@@ -1,8 +1,10 @@
1
- /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
1
+ /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
2
2
  * Use of this file is governed by the BSD 3-clause license that
3
3
  * can be found in the LICENSE.txt file in the project root.
4
4
  */
5
5
 
6
+ #include <string.h>
7
+
6
8
  #include "Exceptions.h"
7
9
  #include "misc/Interval.h"
8
10
  #include "IntStream.h"
@@ -17,27 +19,39 @@ using namespace antlrcpp;
17
19
 
18
20
  using misc::Interval;
19
21
 
20
- ANTLRInputStream::ANTLRInputStream(const std::string &input) {
22
+ ANTLRInputStream::ANTLRInputStream() {
21
23
  InitializeInstanceFields();
22
- load(input);
23
24
  }
24
25
 
25
- ANTLRInputStream::ANTLRInputStream(const char data_[], size_t numberOfActualCharsInArray)
26
- : ANTLRInputStream(std::string(data_, numberOfActualCharsInArray)) {
26
+ #if __cplusplus >= 201703L
27
+ ANTLRInputStream::ANTLRInputStream(const std::string_view &input): ANTLRInputStream() {
28
+ load(input.data(), input.length());
27
29
  }
30
+ #endif
28
31
 
29
- ANTLRInputStream::ANTLRInputStream(std::istream &stream) {
30
- InitializeInstanceFields();
32
+ ANTLRInputStream::ANTLRInputStream(const std::string &input): ANTLRInputStream() {
33
+ load(input.data(), input.size());
34
+ }
35
+
36
+ ANTLRInputStream::ANTLRInputStream(const char *data, size_t length) {
37
+ load(data, length);
38
+ }
39
+
40
+ ANTLRInputStream::ANTLRInputStream(std::istream &stream): ANTLRInputStream() {
31
41
  load(stream);
32
42
  }
33
43
 
34
44
  void ANTLRInputStream::load(const std::string &input) {
45
+ load(input.data(), input.size());
46
+ }
47
+
48
+ void ANTLRInputStream::load(const char *data, size_t length) {
35
49
  // Remove the UTF-8 BOM if present.
36
- const char bom[4] = "\xef\xbb\xbf";
37
- if (input.compare(0, 3, bom, 3) == 0)
38
- _data = antlrcpp::utf8_to_utf32(input.data() + 3, input.data() + input.size());
50
+ const char *bom = "\xef\xbb\xbf";
51
+ if (length >= 3 && strncmp(data, bom, 3) == 0)
52
+ _data = antlrcpp::utf8_to_utf32(data + 3, data + length);
39
53
  else
40
- _data = antlrcpp::utf8_to_utf32(input.data(), input.data() + input.size());
54
+ _data = antlrcpp::utf8_to_utf32(data, data + length);
41
55
  p = 0;
42
56
  }
43
57
 
@@ -48,7 +62,7 @@ void ANTLRInputStream::load(std::istream &stream) {
48
62
  _data.clear();
49
63
 
50
64
  std::string s((std::istreambuf_iterator<char>(stream)), std::istreambuf_iterator<char>());
51
- load(s);
65
+ load(s.data(), s.length());
52
66
  }
53
67
 
54
68
  void ANTLRInputStream::reset() {
@@ -1,4 +1,4 @@
1
- /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
1
+ /* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.
2
2
  * Use of this file is governed by the BSD 3-clause license that
3
3
  * can be found in the LICENSE.txt file in the project root.
4
4
  */
@@ -25,11 +25,18 @@ namespace antlr4 {
25
25
  /// What is name or source of this char stream?
26
26
  std::string name;
27
27
 
28
- ANTLRInputStream(const std::string &input = "");
29
- ANTLRInputStream(const char data_[], size_t numberOfActualCharsInArray);
28
+ ANTLRInputStream();
29
+
30
+ #if __cplusplus >= 201703L
31
+ ANTLRInputStream(const std::string_view &input);
32
+ #endif
33
+
34
+ ANTLRInputStream(const std::string &input);
35
+ ANTLRInputStream(const char *data, size_t length);
30
36
  ANTLRInputStream(std::istream &stream);
31
37
 
32
38
  virtual void load(const std::string &input);
39
+ virtual void load(const char *data, size_t length);
33
40
  virtual void load(std::istream &stream);
34
41
 
35
42
  /// Reset the stream so that it's in the same state it was
@@ -11,7 +11,7 @@
11
11
 
12
12
  using namespace antlr4;
13
13
 
14
- const Ref<TokenFactory<CommonToken>> CommonTokenFactory::DEFAULT = std::make_shared<CommonTokenFactory>();
14
+ const std::unique_ptr<TokenFactory<CommonToken>> CommonTokenFactory::DEFAULT(new CommonTokenFactory);
15
15
 
16
16
  CommonTokenFactory::CommonTokenFactory(bool copyText_) : copyText(copyText_) {
17
17
  }
@@ -22,7 +22,7 @@ namespace antlr4 {
22
22
  * This token factory does not explicitly copy token text when constructing
23
23
  * tokens.</p>
24
24
  */
25
- static const Ref<TokenFactory<CommonToken>> DEFAULT;
25
+ static const std::unique_ptr<TokenFactory<CommonToken>> DEFAULT;
26
26
 
27
27
  protected:
28
28
  /**
@@ -27,7 +27,13 @@ namespace antlr4 {
27
27
  /// </summary>
28
28
  class ANTLR4CPP_PUBLIC IntStream {
29
29
  public:
30
- static const size_t EOF = static_cast<size_t>(-1); // std::numeric_limits<size_t>::max(); doesn't work in VS 2013
30
+ #if __cplusplus >= 201703L
31
+ static constexpr size_t EOF = std::numeric_limits<size_t>::max();
32
+ #else
33
+ enum : size_t {
34
+ EOF = static_cast<size_t>(-1), // std::numeric_limits<size_t>::max(); doesn't work in VS 2013
35
+ };
36
+ #endif
31
37
 
32
38
  /// The value returned by <seealso cref="#LA LA()"/> when the end of the stream is
33
39
  /// reached.
@@ -136,7 +136,7 @@ size_t Lexer::popMode() {
136
136
  }
137
137
 
138
138
 
139
- Ref<TokenFactory<CommonToken>> Lexer::getTokenFactory() {
139
+ TokenFactory<CommonToken>* Lexer::getTokenFactory() {
140
140
  return _factory;
141
141
  }
142
142
 
@@ -284,7 +284,7 @@ size_t Lexer::getNumberOfSyntaxErrors() {
284
284
  void Lexer::InitializeInstanceFields() {
285
285
  _syntaxErrors = 0;
286
286
  token = nullptr;
287
- _factory = CommonTokenFactory::DEFAULT;
287
+ _factory = CommonTokenFactory::DEFAULT.get();
288
288
  tokenStartCharIndex = INVALID_INDEX;
289
289
  tokenStartLine = 0;
290
290
  tokenStartCharPositionInLine = 0;