Repository: MiSawa/xq (rust)

Issue:
Cannot use null and booleans in object value
I noticed that I can't use some values in in object value.
```sh
❯ xq -n '{x: null}'
Error: compile query

Caused by:
    CompileError(UnknownFunction(Identifier("null"), 0))

❯ xq -n '{x: true}'
Error: compile query

Caused by:
    CompileError(UnknownFunction(Identifier("true"), 0))

❯ xq -n '{x: false}'
Error: compile query

Caused by:
    CompileError(UnknownFunction(Identifier("false"), 0))

❯ xq --version
xq 0.2.3-a7d4cfbf962f3570b326dd97ecf288365d396ed4
```

Pull request description:
Fix object keyword
Fix #67 

Patch:
diff --git a/README.md b/README.md
index 5851a43..79410a4 100644
--- a/README.md
+++ b/README.md
@@ -81,6 +81,7 @@ $ cargo set-version --bump patch    # or just edit Cargo.toml to bump the versio
 $ cargo build                       # to generate Cargo.lock
 $ git commit -am "Bump version"     # so that there's no uncommited changes
 $ git tag v0.2.x                    # just in case...
+$ git push
 $ git push --tags
 $ cargo publish
 ```
diff --git a/src/lang/lexer.rs b/src/lang/lexer.rs
index 2e0ec5b..ad6c2fb 100644
--- a/src/lang/lexer.rs
+++ b/src/lang/lexer.rs
@@ -491,9 +491,6 @@ lexer! {
         "as"      => |lexer| handle_keyword!(lexer, Keyword::As),
         "label"   => |lexer| handle_keyword!(lexer, Keyword::Label),
         "break"   => |lexer| handle_keyword!(lexer, Keyword::Break),
-        "null"    => |lexer| handle_keyword!(lexer, Keyword::Null),
-        "false"   => |lexer| handle_keyword!(lexer, Keyword::False),
-        "true"    => |lexer| handle_keyword!(lexer, Keyword::True),
         "if"      => |lexer| handle_keyword!(lexer, Keyword::If),
         "then"    => |lexer| handle_keyword!(lexer, Keyword::Then),
         "elif"    => |lexer| handle_keyword!(lexer, Keyword::Elif),
@@ -504,6 +501,13 @@ lexer! {
         "reduce"  => |lexer| handle_keyword!(lexer, Keyword::Reduce),
         "foreach" => |lexer| handle_keyword!(lexer, Keyword::Foreach),
 
+        // These three keywords can be in a value of an object entry.
+        // Since we don't care this in the post processing anyway,
+        // we always treat them as a keyword.
+        "null"    = Token::Keyword(Keyword::Null),
+        "false"   = Token::Keyword(Keyword::False),
+        "true"    = Token::Keyword(Keyword::True),
+
         '.' $ident_start $ident_follow* => |lexer| {
             lexer.return_(Token::Field(&lexer.match_()[1..]))
         },


Test patch:
diff --git a/tests/hand_written/mod.rs b/tests/hand_written/mod.rs
index 2be4b5f..c3ceb3b 100644
--- a/tests/hand_written/mod.rs
+++ b/tests/hand_written/mod.rs
@@ -347,3 +347,16 @@ test!(
     [1,2]
     "#
 );
+
+test!(
+    keyword_in_object,
+    r#"
+    {x: null, y: true, z: false, true: 1, false: 2, null: 3, try: 4, else: 5}
+    "#,
+    r#"
+    null
+    "#,
+    r#"
+    {"x": null, "y": true, "z": false, "true": 1, "false": 2, "null": 3, "try": 4, "else": 5}
+    "#
+);