From 20b916b3c90828028c4e981dea06696c23998cf1 Mon Sep 17 00:00:00 2001 From: Adrian Kummerlaender Date: Sun, 16 Apr 2017 13:37:23 +0200 Subject: Prevent definition nesting --- source/state/definition.d | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'source/state') 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; -- cgit v1.2.3