2018-12-13 13:39:08 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
module Gitlab
|
|
|
|
module Ci
|
|
|
|
module Pipeline
|
|
|
|
module Expression
|
|
|
|
module Lexeme
|
|
|
|
class Base
|
|
|
|
def evaluate(**variables)
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
2020-10-24 23:57:45 +05:30
|
|
|
def name
|
|
|
|
self.class.name.demodulize.underscore
|
|
|
|
end
|
|
|
|
|
2018-03-27 19:54:05 +05:30
|
|
|
def self.build(token)
|
|
|
|
raise NotImplementedError
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.scan(scanner)
|
2019-09-04 21:01:54 +05:30
|
|
|
if scanner.scan(pattern)
|
2018-03-27 19:54:05 +05:30
|
|
|
Expression::Token.new(scanner.matched, self)
|
|
|
|
end
|
|
|
|
end
|
2019-09-04 21:01:54 +05:30
|
|
|
|
|
|
|
def self.pattern
|
|
|
|
self::PATTERN
|
|
|
|
end
|
2020-10-24 23:57:45 +05:30
|
|
|
|
|
|
|
def self.consume?(lexeme)
|
|
|
|
lexeme && precedence >= lexeme.precedence
|
|
|
|
end
|
2018-03-27 19:54:05 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|