BigW Consortium Gitlab

Commit 7c6063dd by Grzegorz Bizon

Add a base class for pipeline expressions tokens

parent 34bebde8
...@@ -2,7 +2,7 @@ module Gitlab ...@@ -2,7 +2,7 @@ module Gitlab
module Ci module Ci
module Pipeline module Pipeline
module Expression module Expression
class Equality class Equality < Expression::Token
PATTERN = /==/.freeze PATTERN = /==/.freeze
def initialize(left, right) def initialize(left, right)
......
...@@ -2,7 +2,7 @@ module Gitlab ...@@ -2,7 +2,7 @@ module Gitlab
module Ci module Ci
module Pipeline module Pipeline
module Expression module Expression
class String class String < Expression::Token
PATTERN = /("|')(?<value>.+)('|")/.freeze PATTERN = /("|')(?<value>.+)('|")/.freeze
def initialize(value) def initialize(value)
......
module Gitlab
module Ci
module Pipeline
module Expression
class Token
def evaluate(**variables)
raise NotImplementedError
end
def self.build(string)
raise NotImplementedError
end
def self.scan(scanner)
scanner.scan(PATTERN)
end
end
end
end
end
end
...@@ -2,7 +2,7 @@ module Gitlab ...@@ -2,7 +2,7 @@ module Gitlab
module Ci module Ci
module Pipeline module Pipeline
module Expression module Expression
class Equality class Equality < Expression::Token
PATTERN = /$(?<name>\w+)/.freeze PATTERN = /$(?<name>\w+)/.freeze
def initialize(value) def initialize(value)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment