Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
890df1b1
Commit
890df1b1
authored
Feb 21, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add code that evaluates pipelines expressions
parent
2c4aa504
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
lib/gitlab/ci/pipeline/expression/statement.rb
lib/gitlab/ci/pipeline/expression/statement.rb
+8
-3
No files found.
lib/gitlab/ci/pipeline/expression/statement.rb
View file @
890df1b1
...
@@ -31,8 +31,8 @@ module Gitlab
...
@@ -31,8 +31,8 @@ module Gitlab
end
end
##
##
# Our syntax is very simple, so we don't
need yet
to implement a
# Our syntax is very simple, so we don't
yet need
to implement a
# recur
i
sive parser, we can use the most simple approach to create
# recursive parser, we can use the most simple approach to create
# a reverse descent parse tree "by hand".
# a reverse descent parse tree "by hand".
#
#
def
parse_tree
def
parse_tree
...
@@ -42,7 +42,7 @@ module Gitlab
...
@@ -42,7 +42,7 @@ module Gitlab
raise
ParserError
,
'Unknown pipeline expression!'
raise
ParserError
,
'Unknown pipeline expression!'
end
end
if
lexeme
s
.
many?
if
token
s
.
many?
Expression
::
Equals
.
new
(
tokens
.
first
.
build
,
tokens
.
last
.
build
)
Expression
::
Equals
.
new
(
tokens
.
first
.
build
,
tokens
.
last
.
build
)
else
else
tokens
.
first
.
build
tokens
.
first
.
build
...
@@ -50,6 +50,11 @@ module Gitlab
...
@@ -50,6 +50,11 @@ module Gitlab
end
end
def
evaluate
def
evaluate
if
tokens
.
many?
parse_tree
.
evaluate
else
parse_tree
.
evaluate
.
present?
end
end
end
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment