strling 3.0.0 → 4.0.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/LICENSE +201 -0
- data/README.md +31 -67
- data/lib/strling/native_client.rb +231 -0
- data/lib/strling/requests.rb +81 -0
- data/lib/strling/stdlib_generated.rb +32 -0
- data/lib/strling.rb +37 -18
- metadata +17 -18
- data/lib/strling/core/compiler.rb +0 -96
- data/lib/strling/core/errors.rb +0 -174
- data/lib/strling/core/hint_engine.rb +0 -43
- data/lib/strling/core/ir.rb +0 -348
- data/lib/strling/core/nodes.rb +0 -445
- data/lib/strling/core/parser.rb +0 -579
- data/lib/strling/core/validator.rb +0 -101
- data/lib/strling/emitters/pcre2.rb +0 -246
- data/lib/strling/ir.rb +0 -201
- data/lib/strling/nodes.rb +0 -102
- data/lib/strling/simply.rb +0 -90
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Generated from the canonical standard-library registry. Do not edit.
|
|
4
|
+
# These lexical helpers record Simply recipes; they do not validate semantics.
|
|
5
|
+
module Strling
|
|
6
|
+
STDLIB_SURFACE_SOURCE_SHA256 = '94f28b16873abd0b57b324b76e236cbe17706f5310758e066a88a776e4930a3d'
|
|
7
|
+
STDLIB_REGISTRY_VERSION = '1.0.0'
|
|
8
|
+
STDLIB_HELPER_IDS = %w[stdlib.date_time stdlib.email stdlib.ip stdlib.url stdlib.uuid].freeze
|
|
9
|
+
|
|
10
|
+
module_function
|
|
11
|
+
|
|
12
|
+
def date_time(step_id)
|
|
13
|
+
stdlib_helper(step_id, 'stdlib.date_time')
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def email(step_id)
|
|
17
|
+
stdlib_helper(step_id, 'stdlib.email')
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def ip(step_id, version: nil)
|
|
21
|
+
stdlib_helper(step_id, 'stdlib.ip', 'version' => version)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def url(step_id)
|
|
25
|
+
stdlib_helper(step_id, 'stdlib.url')
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def uuid(step_id, version: nil)
|
|
29
|
+
stdlib_helper(step_id, 'stdlib.uuid', 'version' => version)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
end
|
data/lib/strling.rb
CHANGED
|
@@ -1,25 +1,44 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
# for the STRling DSL and compiler, offering a readable, maintainable
|
|
7
|
-
# alternative to traditional regular expressions.
|
|
8
|
-
#
|
|
9
|
-
# The STRling module serves as the namespace for all STRling functionality,
|
|
10
|
-
# including core data structures (nodes, IR, errors) and the parser/compiler
|
|
11
|
-
# pipeline.
|
|
12
|
-
|
|
13
|
-
require_relative 'strling/nodes'
|
|
14
|
-
require_relative 'strling/ir'
|
|
15
|
-
require_relative 'strling/simply'
|
|
3
|
+
require_relative 'strling/native_client'
|
|
4
|
+
require_relative 'strling/requests'
|
|
5
|
+
require_relative 'strling/stdlib_generated'
|
|
16
6
|
|
|
7
|
+
# Thin Ruby projection of the versioned canonical STRling interop protocol.
|
|
17
8
|
module Strling
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
VERSION = '4.0.1'
|
|
10
|
+
INTEROP_PROTOCOL_VERSION = '1.0.0'
|
|
11
|
+
NATIVE_ABI_VERSION = 1
|
|
12
|
+
MAX_INTEROP_REQUEST_BYTES = 10_485_760
|
|
13
|
+
MAX_INTEROP_RESPONSE_BYTES = 33_554_432
|
|
20
14
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
15
|
+
class Error < StandardError; end
|
|
16
|
+
|
|
17
|
+
class NativeAdapterError < Error
|
|
18
|
+
attr_reader :kind, :status
|
|
19
|
+
|
|
20
|
+
def initialize(kind, message, status: nil)
|
|
21
|
+
@kind = kind
|
|
22
|
+
@status = status
|
|
23
|
+
super(status.nil? ? message : "#{message} (status #{status})")
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
class InteropProtocolError < Error
|
|
28
|
+
attr_reader :code, :path, :operation
|
|
29
|
+
|
|
30
|
+
def initialize(response)
|
|
31
|
+
error = response.fetch('error')
|
|
32
|
+
@code = error.fetch('code')
|
|
33
|
+
@path = error.fetch('path')
|
|
34
|
+
@operation = response['operation']
|
|
35
|
+
super("#{code} at #{path}")
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
module_function
|
|
40
|
+
|
|
41
|
+
def load_native(library_path)
|
|
42
|
+
NativeClient.load(library_path)
|
|
24
43
|
end
|
|
25
44
|
end
|
metadata
CHANGED
|
@@ -1,40 +1,35 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: strling
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 4.0.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- STRling Team
|
|
8
|
+
autorequire:
|
|
8
9
|
bindir: bin
|
|
9
10
|
cert_chain: []
|
|
10
|
-
date:
|
|
11
|
+
date: 2026-11-17 00:00:00.000000000 Z
|
|
11
12
|
dependencies: []
|
|
12
|
-
description: STRling
|
|
13
|
-
|
|
13
|
+
description: STRling projects canonical request and result data through a caller-selected
|
|
14
|
+
strling.c-abi v1 library.
|
|
14
15
|
email: dev@strling.io
|
|
15
16
|
executables: []
|
|
16
17
|
extensions: []
|
|
17
18
|
extra_rdoc_files: []
|
|
18
19
|
files:
|
|
20
|
+
- LICENSE
|
|
19
21
|
- README.md
|
|
20
22
|
- lib/strling.rb
|
|
21
|
-
- lib/strling/
|
|
22
|
-
- lib/strling/
|
|
23
|
-
- lib/strling/
|
|
24
|
-
- lib/strling/core/ir.rb
|
|
25
|
-
- lib/strling/core/nodes.rb
|
|
26
|
-
- lib/strling/core/parser.rb
|
|
27
|
-
- lib/strling/core/validator.rb
|
|
28
|
-
- lib/strling/emitters/pcre2.rb
|
|
29
|
-
- lib/strling/ir.rb
|
|
30
|
-
- lib/strling/nodes.rb
|
|
31
|
-
- lib/strling/simply.rb
|
|
23
|
+
- lib/strling/native_client.rb
|
|
24
|
+
- lib/strling/requests.rb
|
|
25
|
+
- lib/strling/stdlib_generated.rb
|
|
32
26
|
homepage: https://github.com/strling-lang/strling
|
|
33
27
|
licenses:
|
|
34
|
-
-
|
|
28
|
+
- Apache-2.0
|
|
35
29
|
metadata:
|
|
36
30
|
source_code_uri: https://github.com/strling-lang/strling
|
|
37
31
|
bug_tracker_uri: https://github.com/strling-lang/strling/issues
|
|
32
|
+
post_install_message:
|
|
38
33
|
rdoc_options: []
|
|
39
34
|
require_paths:
|
|
40
35
|
- lib
|
|
@@ -43,13 +38,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
43
38
|
- - ">="
|
|
44
39
|
- !ruby/object:Gem::Version
|
|
45
40
|
version: '3.0'
|
|
41
|
+
- - "<"
|
|
42
|
+
- !ruby/object:Gem::Version
|
|
43
|
+
version: '4.0'
|
|
46
44
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
47
45
|
requirements:
|
|
48
46
|
- - ">="
|
|
49
47
|
- !ruby/object:Gem::Version
|
|
50
48
|
version: '0'
|
|
51
49
|
requirements: []
|
|
52
|
-
rubygems_version: 4.
|
|
50
|
+
rubygems_version: 3.4.20
|
|
51
|
+
signing_key:
|
|
53
52
|
specification_version: 4
|
|
54
|
-
summary:
|
|
53
|
+
summary: Thin Ruby adapter for the canonical STRling compiler.
|
|
55
54
|
test_files: []
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# STRling Compiler - AST to IR Transformation
|
|
4
|
-
#
|
|
5
|
-
# This module transforms Abstract Syntax Tree (AST) nodes from the parser
|
|
6
|
-
# into Intermediate Representation (IR) nodes. The IR is a simplified,
|
|
7
|
-
# language-agnostic representation that can be easily emitted to various
|
|
8
|
-
# target regex flavors.
|
|
9
|
-
#
|
|
10
|
-
# The compiler performs:
|
|
11
|
-
# - AST node type transformation (Node → IROp)
|
|
12
|
-
# - Semantic validation
|
|
13
|
-
# - Optimization opportunities (future)
|
|
14
|
-
|
|
15
|
-
require_relative 'nodes'
|
|
16
|
-
require_relative 'ir'
|
|
17
|
-
|
|
18
|
-
module Strling
|
|
19
|
-
module Core
|
|
20
|
-
# Compiler class for transforming AST to IR
|
|
21
|
-
class Compiler
|
|
22
|
-
# Compile an AST node tree to IR
|
|
23
|
-
#
|
|
24
|
-
# @param node [Node] The root AST node to compile
|
|
25
|
-
# @return [IROp] The compiled IR root node
|
|
26
|
-
def self.compile(node)
|
|
27
|
-
new.compile_node(node)
|
|
28
|
-
end
|
|
29
|
-
|
|
30
|
-
# Compile a single AST node to its IR equivalent
|
|
31
|
-
#
|
|
32
|
-
# @param node [Node] The AST node to compile
|
|
33
|
-
# @return [IROp] The corresponding IR node
|
|
34
|
-
def compile_node(node)
|
|
35
|
-
case node
|
|
36
|
-
when Alt
|
|
37
|
-
IRAlt.new(node.branches.map { |b| compile_node(b) })
|
|
38
|
-
when Seq
|
|
39
|
-
IRSeq.new(node.parts.map { |p| compile_node(p) })
|
|
40
|
-
when Lit
|
|
41
|
-
IRLit.new(node.value)
|
|
42
|
-
when Dot
|
|
43
|
-
IRDot.new
|
|
44
|
-
when Anchor
|
|
45
|
-
IRAnchor.new(node.at)
|
|
46
|
-
when CharClass
|
|
47
|
-
IRCharClass.new(
|
|
48
|
-
node.negated,
|
|
49
|
-
node.items.map { |item| compile_class_item(item) }
|
|
50
|
-
)
|
|
51
|
-
when Quant
|
|
52
|
-
IRQuant.new(
|
|
53
|
-
compile_node(node.child),
|
|
54
|
-
node.min,
|
|
55
|
-
node.max,
|
|
56
|
-
node.mode
|
|
57
|
-
)
|
|
58
|
-
when Group
|
|
59
|
-
IRGroup.new(
|
|
60
|
-
node.capturing,
|
|
61
|
-
compile_node(node.body),
|
|
62
|
-
name: node.name,
|
|
63
|
-
atomic: node.atomic
|
|
64
|
-
)
|
|
65
|
-
when Backref
|
|
66
|
-
IRBackref.new(by_index: node.by_index, by_name: node.by_name)
|
|
67
|
-
when Look
|
|
68
|
-
IRLook.new(node.dir, node.neg, compile_node(node.body))
|
|
69
|
-
else
|
|
70
|
-
raise "Unknown AST node type: #{node.class}"
|
|
71
|
-
end
|
|
72
|
-
end
|
|
73
|
-
|
|
74
|
-
private
|
|
75
|
-
|
|
76
|
-
# Compile a character class item
|
|
77
|
-
def compile_class_item(item)
|
|
78
|
-
case item
|
|
79
|
-
when ClassRange
|
|
80
|
-
IRClassRange.new(item.from_ch, item.to_ch)
|
|
81
|
-
when ClassLiteral
|
|
82
|
-
IRClassLiteral.new(item.ch)
|
|
83
|
-
when ClassEscape
|
|
84
|
-
IRClassEscape.new(item.type, property: item.property)
|
|
85
|
-
else
|
|
86
|
-
raise "Unknown class item type: #{item.class}"
|
|
87
|
-
end
|
|
88
|
-
end
|
|
89
|
-
end
|
|
90
|
-
|
|
91
|
-
# Module-level compile function for convenience
|
|
92
|
-
def self.compile(node)
|
|
93
|
-
Compiler.compile(node)
|
|
94
|
-
end
|
|
95
|
-
end
|
|
96
|
-
end
|
data/lib/strling/core/errors.rb
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# STRling Error Classes - Rich Error Handling for Instructional Diagnostics
|
|
4
|
-
#
|
|
5
|
-
# This module provides enhanced error classes that deliver context-aware,
|
|
6
|
-
# instructional error messages. The STRlingParseError class stores detailed
|
|
7
|
-
# information about syntax errors including position, context, and beginner-friendly
|
|
8
|
-
# hints for resolution.
|
|
9
|
-
|
|
10
|
-
module Strling
|
|
11
|
-
module Core
|
|
12
|
-
# Rich parse error with position tracking and instructional hints.
|
|
13
|
-
#
|
|
14
|
-
# This error class transforms parse failures into learning opportunities by
|
|
15
|
-
# providing:
|
|
16
|
-
# - The specific error message
|
|
17
|
-
# - The exact position where the error occurred
|
|
18
|
-
# - The full line of text containing the error
|
|
19
|
-
# - A beginner-friendly hint explaining how to fix the issue
|
|
20
|
-
class STRlingParseError < StandardError
|
|
21
|
-
# @return [String] A concise description of what went wrong
|
|
22
|
-
attr_reader :message
|
|
23
|
-
|
|
24
|
-
# @return [Integer] The character position (0-indexed) where the error occurred
|
|
25
|
-
attr_reader :pos
|
|
26
|
-
|
|
27
|
-
# @return [String] The full input text being parsed
|
|
28
|
-
attr_reader :text
|
|
29
|
-
|
|
30
|
-
# @return [String, nil] An instructional hint explaining how to fix the error
|
|
31
|
-
attr_reader :hint
|
|
32
|
-
|
|
33
|
-
# Initialize a STRlingParseError.
|
|
34
|
-
#
|
|
35
|
-
# @param message [String] A concise description of what went wrong
|
|
36
|
-
# @param pos [Integer] The character position (0-indexed) where the error occurred
|
|
37
|
-
# @param text [String] The full input text being parsed (default: "")
|
|
38
|
-
# @param hint [String, nil] An instructional hint explaining how to fix the error (default: nil)
|
|
39
|
-
def initialize(message, pos, text: '', hint: nil)
|
|
40
|
-
@message = message
|
|
41
|
-
@pos = pos
|
|
42
|
-
@text = text
|
|
43
|
-
@hint = hint
|
|
44
|
-
|
|
45
|
-
# Call parent constructor with formatted message
|
|
46
|
-
super(format_error)
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
# Format the error in the visionary state format.
|
|
50
|
-
#
|
|
51
|
-
# @return [String] A formatted error message with context and hints
|
|
52
|
-
def format_error
|
|
53
|
-
if text.empty?
|
|
54
|
-
# Fallback to simple format if no text provided
|
|
55
|
-
return "#{message} at position #{pos}"
|
|
56
|
-
end
|
|
57
|
-
|
|
58
|
-
# Find the line containing the error
|
|
59
|
-
lines = text.lines(chomp: true)
|
|
60
|
-
current_pos = 0
|
|
61
|
-
line_num = 1
|
|
62
|
-
line_text = ''
|
|
63
|
-
col = pos
|
|
64
|
-
|
|
65
|
-
lines.each_with_index do |line, i|
|
|
66
|
-
line_len = line.length + 1 # +1 for newline
|
|
67
|
-
if current_pos + line_len > pos
|
|
68
|
-
line_num = i + 1
|
|
69
|
-
line_text = line
|
|
70
|
-
col = pos - current_pos
|
|
71
|
-
break
|
|
72
|
-
end
|
|
73
|
-
current_pos += line_len
|
|
74
|
-
end
|
|
75
|
-
|
|
76
|
-
# Error is beyond the last line
|
|
77
|
-
if line_text.empty?
|
|
78
|
-
if !lines.empty?
|
|
79
|
-
line_num = lines.length
|
|
80
|
-
line_text = lines[-1]
|
|
81
|
-
col = line_text.length
|
|
82
|
-
else
|
|
83
|
-
line_text = text
|
|
84
|
-
col = pos
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
|
|
88
|
-
# Build the formatted error message
|
|
89
|
-
parts = ["STRling Parse Error: #{message}", '']
|
|
90
|
-
parts << "> #{line_num} | #{line_text}"
|
|
91
|
-
parts << "> | #{' ' * col}^"
|
|
92
|
-
|
|
93
|
-
if hint
|
|
94
|
-
parts << ''
|
|
95
|
-
parts << "Hint: #{hint}"
|
|
96
|
-
end
|
|
97
|
-
|
|
98
|
-
parts.join("\n")
|
|
99
|
-
end
|
|
100
|
-
|
|
101
|
-
# Return the formatted error message.
|
|
102
|
-
#
|
|
103
|
-
# @return [String] The formatted error message
|
|
104
|
-
def to_s
|
|
105
|
-
format_error
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
# Backwards/JS-friendly alias for getting the formatted error string.
|
|
109
|
-
#
|
|
110
|
-
# @return [String] The formatted error message (same as `to_s`)
|
|
111
|
-
def to_formatted_string
|
|
112
|
-
format_error
|
|
113
|
-
end
|
|
114
|
-
|
|
115
|
-
# Convert the error to LSP Diagnostic format.
|
|
116
|
-
#
|
|
117
|
-
# Returns a hash compatible with the Language Server Protocol
|
|
118
|
-
# Diagnostic specification, which can be serialized to JSON for
|
|
119
|
-
# communication with LSP clients.
|
|
120
|
-
#
|
|
121
|
-
# @return [Hash] A hash containing:
|
|
122
|
-
# - range: The line/column range where the error occurred
|
|
123
|
-
# - severity: Error severity (1 = Error)
|
|
124
|
-
# - message: The error message with hint if available
|
|
125
|
-
# - source: "STRling"
|
|
126
|
-
# - code: A normalized error code derived from the message
|
|
127
|
-
def to_lsp_diagnostic
|
|
128
|
-
# Find the line and column containing the error
|
|
129
|
-
lines = text.empty? ? [] : text.lines(chomp: true)
|
|
130
|
-
current_pos = 0
|
|
131
|
-
line_num = 0 # 0-indexed for LSP
|
|
132
|
-
col = pos
|
|
133
|
-
|
|
134
|
-
lines.each_with_index do |line, i|
|
|
135
|
-
line_len = line.length + 1 # +1 for newline
|
|
136
|
-
if current_pos + line_len > pos
|
|
137
|
-
line_num = i
|
|
138
|
-
col = pos - current_pos
|
|
139
|
-
break
|
|
140
|
-
end
|
|
141
|
-
current_pos += line_len
|
|
142
|
-
end
|
|
143
|
-
|
|
144
|
-
# Error is beyond the last line
|
|
145
|
-
if col == pos && !lines.empty?
|
|
146
|
-
line_num = lines.length - 1
|
|
147
|
-
col = lines[-1].length
|
|
148
|
-
end
|
|
149
|
-
|
|
150
|
-
# Build the diagnostic message
|
|
151
|
-
diagnostic_message = message
|
|
152
|
-
diagnostic_message += "\n\nHint: #{hint}" if hint
|
|
153
|
-
|
|
154
|
-
# Create error code from message (normalize to snake_case)
|
|
155
|
-
error_code = message.downcase
|
|
156
|
-
[' ', "'", '"', '(', ')', '[', ']', '{', '}', '\\', '/'].each do |char|
|
|
157
|
-
error_code = error_code.gsub(char, '_')
|
|
158
|
-
end
|
|
159
|
-
error_code = error_code.split('_').reject(&:empty?).join('_')
|
|
160
|
-
|
|
161
|
-
{
|
|
162
|
-
range: {
|
|
163
|
-
start: { line: line_num, character: col },
|
|
164
|
-
end: { line: line_num, character: col + 1 }
|
|
165
|
-
},
|
|
166
|
-
severity: 1, # 1 = Error, 2 = Warning, 3 = Information, 4 = Hint
|
|
167
|
-
message: diagnostic_message,
|
|
168
|
-
source: 'STRling',
|
|
169
|
-
code: error_code
|
|
170
|
-
}
|
|
171
|
-
end
|
|
172
|
-
end
|
|
173
|
-
end
|
|
174
|
-
end
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
# STRling Hint Engine - Context-Aware Error Hints
|
|
4
|
-
#
|
|
5
|
-
# This module provides intelligent, beginner-friendly hints for parse errors.
|
|
6
|
-
# It analyzes error messages and context to suggest likely fixes and
|
|
7
|
-
# explanations for common mistakes.
|
|
8
|
-
|
|
9
|
-
module Strling
|
|
10
|
-
module Core
|
|
11
|
-
# Generate a helpful hint for a parse error
|
|
12
|
-
#
|
|
13
|
-
# @param message [String] The error message
|
|
14
|
-
# @param text [String] The full input text being parsed
|
|
15
|
-
# @param pos [Integer] The position where the error occurred
|
|
16
|
-
# @return [String, nil] A helpful hint, or nil if no specific hint applies
|
|
17
|
-
def self.get_hint(message, text, pos)
|
|
18
|
-
# Extract key parts of the error message
|
|
19
|
-
case message
|
|
20
|
-
when /Invalid quantifier/
|
|
21
|
-
"Quantifiers (*, +, ?, {m,n}) must follow something to repeat. They can't appear at the start of a pattern or immediately after another quantifier."
|
|
22
|
-
when /Cannot quantify anchor/
|
|
23
|
-
"Anchors (^, $, \\b, \\B, etc.) match positions, not characters, so they can't be repeated with quantifiers like * or +."
|
|
24
|
-
when /Unclosed/
|
|
25
|
-
"Make sure every opening bracket has a matching closing bracket. Check for: ( ), [ ], { }"
|
|
26
|
-
when /Unmatched/
|
|
27
|
-
"This closing bracket doesn't have a matching opening bracket. Did you mean to escape it?"
|
|
28
|
-
when /Unknown escape sequence/
|
|
29
|
-
"This escape sequence isn't recognized. Common escapes include: \\n (newline), \\t (tab), \\d (digit), \\w (word character), \\s (whitespace)."
|
|
30
|
-
when /Invalid flag/
|
|
31
|
-
"Valid flags are: i (case-insensitive), m (multiline), s (dotall), u (unicode), x (extended/free-spacing)."
|
|
32
|
-
when /Alternation lacks/
|
|
33
|
-
"Alternation (|) requires a pattern on both sides. Example: 'cat|dog', not 'cat|' or '|dog'."
|
|
34
|
-
when /Unexpected trailing input/
|
|
35
|
-
"The pattern ended but there's still input remaining. Check for extra characters or unmatched brackets."
|
|
36
|
-
when /Directive after pattern content/
|
|
37
|
-
"Directives like %flags must appear before the pattern content, not after."
|
|
38
|
-
else
|
|
39
|
-
nil
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
end
|
|
43
|
-
end
|