diff options
author | Adrian Kummerlaender | 2017-04-16 13:37:23 +0200 |
---|---|---|
committer | Adrian Kummerlaender | 2017-04-16 13:37:23 +0200 |
commit | 20b916b3c90828028c4e981dea06696c23998cf1 (patch) | |
tree | 4266819b8a76509056b5c24ac1d10142cbd0eac0 /source/state | |
parent | fe08adffcf1446dce2a7d366f7f12c90fdce7e58 (diff) | |
download | slang-20b916b3c90828028c4e981dea06696c23998cf1.tar slang-20b916b3c90828028c4e981dea06696c23998cf1.tar.gz slang-20b916b3c90828028c4e981dea06696c23998cf1.tar.bz2 slang-20b916b3c90828028c4e981dea06696c23998cf1.tar.lz slang-20b916b3c90828028c4e981dea06696c23998cf1.tar.xz slang-20b916b3c90828028c4e981dea06696c23998cf1.tar.zst slang-20b916b3c90828028c4e981dea06696c23998cf1.zip |
Prevent definition nesting
Diffstat (limited to 'source/state')
-rw-r--r-- | source/state/definition.d | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/source/state/definition.d b/source/state/definition.d index ab100d5..6f41275 100644 --- a/source/state/definition.d +++ b/source/state/definition.d @@ -70,11 +70,15 @@ bool handle(string word) { return false; } } else { - if ( word == ";" ) { - register(definition); - definition.nullify; - } else { - definition.insertBack(Token(word)); + switch ( word ) { + case "ยง" : + throw new Exception("definitions may not be nested"); + case ";" : + register(definition); + definition.nullify; + break; + default: + definition.insertBack(Token(word)); } return true; |