From 682e71defc8950daedf0c165436c007744504547 Mon Sep 17 00:00:00 2001 From: Ilya Rezvov Date: Tue, 20 Mar 2018 21:33:11 -0700 Subject: [PATCH] fix tokenizing of numbers and expressions of offset --- src/Language/Wasm/Lexer.x | 4 ++-- src/Language/Wasm/Parser.y | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Language/Wasm/Lexer.x b/src/Language/Wasm/Lexer.x index 92f696b..f201d30 100644 --- a/src/Language/Wasm/Lexer.x +++ b/src/Language/Wasm/Lexer.x @@ -33,8 +33,8 @@ $doublequote = \" @linecomment = ";;" $linechar* \x0A @startblockcomment = "(;" @endblockcomment = ";)" -@num = $digit (\_? $digit*) -@hexnum = $hexdigit (\_? $hexdigit*) +@num = $digit (\_? $digit*)* +@hexnum = $hexdigit (\_? $hexdigit*)* @id = "$" $idchar+ @floatfrac = @num "." (@num)? @exp = [Ee] $sign? @num diff --git a/src/Language/Wasm/Parser.y b/src/Language/Wasm/Parser.y index a5aa6bd..9bf7f27 100644 --- a/src/Language/Wasm/Parser.y +++ b/src/Language/Wasm/Parser.y @@ -960,7 +960,7 @@ start :: { StartFunction } -- but collection of testcases omits 'offset' in this position -- I am going to support both options for now, but maybe it has to be updated in future. offsetexpr :: { [Instruction] } - : 'offset' foldedinstr ')' { $2 } + : 'offset' list(foldedinstr) ')' { concat $2 } | foldedinstr1 { $1 } elemsegment :: { ElemSegment }