Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-02-22 15:54:22 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-02-22 15:54:22 +0300
commit867a4f68cbbe58652e8389e05edfd36df81cb72b (patch)
treeac3451c33a5f812f3405bc2fdabbe8eca82090f8 /lib/gitlab/ci/pipeline/expression/lexer.rb
parentb92ce0ccb68d1dd39a1dd06f4a57979db7299526 (diff)
Extract pipeline expressions parser to a separate class
Diffstat (limited to 'lib/gitlab/ci/pipeline/expression/lexer.rb')
-rw-r--r--lib/gitlab/ci/pipeline/expression/lexer.rb8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/gitlab/ci/pipeline/expression/lexer.rb b/lib/gitlab/ci/pipeline/expression/lexer.rb
index 1536374f0da..9334358cd8e 100644
--- a/lib/gitlab/ci/pipeline/expression/lexer.rb
+++ b/lib/gitlab/ci/pipeline/expression/lexer.rb
@@ -17,7 +17,9 @@ module Gitlab
@tokens = []
end
- def tokenize
+ def tokens
+ return @tokens if @tokens.any?
+
MAX_CYCLES.times do
LEXEMES.each do |lexeme|
@scanner.skip(/\s+/) # ignore whitespace
@@ -32,6 +34,10 @@ module Gitlab
raise Lexer::SyntaxError unless @scanner.eos?
end
+
+ def lexemes
+ tokens.map(&:to_lexeme)
+ end
end
end
end