aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2019-01-23 15:28:40 -0800
committerBruce Hill <bruce@bruce-hill.com>2019-01-23 15:28:40 -0800
commitea8ca28ffb117cabd931eb1368a71d09d69de203 (patch)
treefc521339a7c5845d73498c36610fcff660b4f96a /lib
parent7a64bdb40faba8ffd5141c1fda6091d45843e2e4 (diff)
Added honeypot compile action that detects if you try to do an 'else'
without an 'if' and gives a helpful message.
Diffstat (limited to 'lib')
-rw-r--r--lib/core/control_flow.nom7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/core/control_flow.nom b/lib/core/control_flow.nom
index bf044d9..415611b 100644
--- a/lib/core/control_flow.nom
+++ b/lib/core/control_flow.nom
@@ -39,6 +39,13 @@ test:
end
")
+(else $) compiles to:
+ at (this tree) fail ("
+ Compile error: This 'else' is not connected to any 'if' or 'unless' condition.
+ Hint: You should probably have a ".." in front of the "else", to indicate \
+ ..that it's attached to the previous condition.
+ ")
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Conditional expression (ternary operator)