From 68c6452d8a2efaa6ee2df354a302b56414b69b3a Mon Sep 17 00:00:00 2001 From: David Majda Date: Sat, 7 Dec 2013 15:05:35 +0100 Subject: [PATCH] CSS example grammar: Simplify |integer| and |float| rules It's not necessary to parse |parts| in the |integer| and |float| rule into integer/float value. Everywhere these rules are used the result is converted back into string anyway. --- examples/css.pegjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/css.pegjs b/examples/css.pegjs index 940d2ed..798f3d5 100644 --- a/examples/css.pegjs +++ b/examples/css.pegjs @@ -316,10 +316,10 @@ nmchar / escape integer - = parts:$[0-9]+ { return parseInt(parts); } + = parts:$[0-9]+ { return parts; } float - = parts:$([0-9]* "." [0-9]+) { return parseFloat(parts); } + = parts:$([0-9]* "." [0-9]+) { return parts; } string1 = '"' chars:([^\n\r\f\\"] / "\\" nl:nl { return nl } / escape)* '"' {