From 39c5a7606ecc8f5a1ef7eeee1b4d4b522fd1cd3c Mon Sep 17 00:00:00 2001 From: otya128 Date: Wed, 31 Aug 2016 17:20:12 +0900 Subject: [PATCH] =?UTF-8?q?COMMON=20DEF=E3=82=92=E3=83=91=E3=83=BC?= =?UTF-8?q?=E3=82=B9=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SMILEBASIC/parser.d | 16 +++++++++++++++- SMILEBASIC/token.d | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/SMILEBASIC/parser.d b/SMILEBASIC/parser.d index 8a91c80..47dc00f 100644 --- a/SMILEBASIC/parser.d +++ b/SMILEBASIC/parser.d @@ -75,6 +75,7 @@ class Lexical reserved["TRUE"] = TokenType.True; reserved["FALSE"] = TokenType.False; reserved["CALL"] = TokenType.Call; + reserved["COMMON"] = TokenType.Common; reserved.rehash(); } this(wstring input) @@ -526,7 +527,20 @@ class Parser { auto token = lex.front(); Statement statement; - if(token.type == TokenType.Def) + if(token.type == TokenType.Common) + { + lex.popFront(); + token = lex.front(); + if (token.type != TokenType.Def) + { + syntaxError(); + } + else + { + statement = defineFunction(); + } + } + else if(token.type == TokenType.Def) { statement = defineFunction(); } diff --git a/SMILEBASIC/token.d b/SMILEBASIC/token.d index 35277f3..d32fd20 100644 --- a/SMILEBASIC/token.d +++ b/SMILEBASIC/token.d @@ -68,6 +68,7 @@ enum TokenType Use, Exec, Call, + Common, } struct Token