From a9d7cd1953893f0497fdd95e4e9d648c718acddf Mon Sep 17 00:00:00 2001 From: otya128 Date: Wed, 19 Aug 2015 11:37:22 +0900 Subject: [PATCH] =?UTF-8?q?=E8=A4=87=E6=95=B0=E3=81=AE=E5=BC=95=E6=95=B0?= =?UTF-8?q?=E3=81=AEINPUT=E3=81=8C=E6=AD=A3=E5=B8=B8=E3=81=AB=E5=8B=95?= =?UTF-8?q?=E3=81=8F=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SMILEBASIC/TEST.txt | 4 ++-- SMILEBASIC/parser.d | 15 +++++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/SMILEBASIC/TEST.txt b/SMILEBASIC/TEST.txt index 5b4c6d7..d08e8ab 100644 --- a/SMILEBASIC/TEST.txt +++ b/SMILEBASIC/TEST.txt @@ -79,8 +79,8 @@ DEF ONGOSUBTEST RETURN @4 END -INPUT "A";INPUT$ -?INPUT$ +INPUT INPUT$,IN +?INPUT$,IN @DATA_1 DATA "A",1,2,3,4 LOCATE 10, diff --git a/SMILEBASIC/parser.d b/SMILEBASIC/parser.d index 5bf61c9..0f03189 100644 --- a/SMILEBASIC/parser.d +++ b/SMILEBASIC/parser.d @@ -824,7 +824,7 @@ class Parser return null; } auto token = lex.front(); - if(token.type == TokenType.Semicolon || token.type == TokenType.Comma) + if(token.type == TokenType.Semicolon || (token.type == TokenType.Comma && !isLValue(message))) { Input input = new Input(message, token.type == TokenType.Semicolon); do @@ -836,7 +836,6 @@ class Parser syntaxError(); } input.addVariable(expr); - lex.popFront(); token = lex.front(); } while(token.type == TokenType.Comma); return input; @@ -850,6 +849,18 @@ class Parser } Input input = new Input(null, true); input.addVariable(message); + do + { + lex.popFront(); + auto expr = expression(); + if(!isLValue(expr)) + { + syntaxError(); + } + input.addVariable(expr); + token = lex.front(); + } while(token.type == TokenType.Comma); + return input; } }