Skip to content

Commit

Permalink
Fix wrong syntax about frac
Browse files Browse the repository at this point in the history
  • Loading branch information
miloyip committed Sep 19, 2016
1 parent f25ffc9 commit c1215b1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tutorial02/tutorial02.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ static void test_parse_expect_value() {
~~~
number = [ "-" ] int [ frac ] [ exp ]
int = "0" / digit1-9 *digit
frac = "." *digit
frac = "." 1*digit
exp = ("e" / "E") ["-" / "+"] 1*digit
~~~

number 是以十进制表示,它主要由 4 部分顺序组成:负号、整数、小数、指数。只有整数是必需部分。注意和直觉可能不同的是,正号是不合法的。

整数部分如果是 0 开始,只能是单个 0;而由 1-9 开始的话,可以加任意数量的数字(0-9)。也就是说,`0123` 不是一个合法的 JSON 数字。

小数部分比较直观,就是小数点后可有任意数量的数字(0-9)。
小数部分比较直观,就是小数点后是一或多个数字(0-9)。

JSON 可使用科学记数法,指数部分由大写 E 或小写 e 开始,然后可有正负号,之后是一或多个数字(0-9)。

Expand Down

0 comments on commit c1215b1

Please sign in to comment.