Execute user code blocks assigned to tokens
This commit is contained in:
1 parent
92ce30f354
commit
672098ad32
6 files changed
+122
-8
No files matched your search
@@ -2,6 +2,14 @@ class Propane
|
||||
|
||||
class Pattern
|
||||
|
||||
# @return [String, nil]
|
||||
# Code block to execute when the pattern is matched.
|
||||
attr_reader :code
|
||||
|
||||
# @option options [Integer, nil] :code_id
|
||||
# Code block ID.
|
||||
attr_reader :code_id
|
||||
|
||||
# @return [String, nil]
|
||||
# Pattern.
|
||||
attr_reader :pattern
|
||||
@@ -22,6 +30,10 @@ class Propane
|
||||
#
|
||||
# @param options [Hash]
|
||||
# Optional parameters.
|
||||
# @option options [String, nil] :code
|
||||
# Code block to execute when the pattern is matched.
|
||||
# @option options [Integer, nil] :code_id
|
||||
# Code block ID.
|
||||
# @option options [Boolean] :drop
|
||||
# Whether this is a drop pattern.
|
||||
# @option options [String, nil] :pattern
|
||||
@@ -31,6 +43,8 @@ class Propane
|
||||
# @option options [Integer, nil] :line_number
|
||||
# Line number where the token was defined in the input grammar.
|
||||
def initialize(options)
|
||||
@code = options[:code]
|
||||
@code_id = options[:code_id]
|
||||
@drop = options[:drop]
|
||||
@pattern = options[:pattern]
|
||||
@token = options[:token]
|
||||
|
||||
Reference in new issue
Block a user