Skip to content

Commit

Permalink
Merge pull request #36 from kit494way/fix-cell-path
Browse files Browse the repository at this point in the history
Fix parsing of cell path
  • Loading branch information
fdncred authored Dec 20, 2023
2 parents 7ebb76a + 0128b0e commit b0b330f
Show file tree
Hide file tree
Showing 4 changed files with 7,192 additions and 7,155 deletions.
34 changes: 34 additions & 0 deletions corpus/expr/cell_path.nu
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,37 @@ let x = $list.PATH.4
(cell_path
(path)
(path)))))))

====
cellpath-004-underscore-in-path
=====

let x = $env.LAST_EXIT_CODE

-----

(nu_script
(stmt_let
(identifier)
(pipeline
(pipe_element
(val_variable
(cell_path
(path)))))))

====
cellpath-005-hyphen-in-path
=====

let x = $nu.home-path

-----

(nu_script
(stmt_let
(identifier)
(pipeline
(pipe_element
(val_variable
(cell_path
(path)))))))
2 changes: 1 addition & 1 deletion grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -860,7 +860,7 @@ module.exports = grammar({
$._str_back_ticks,
);

const path = choice(prec.right(2, token(/[0-9a-zA-Z]+/)), quoted);
const path = choice(prec.right(2, token(/[0-9a-zA-Z_-]+/)), quoted);

return seq(
PUNC().dot,
Expand Down
4 changes: 2 additions & 2 deletions src/grammar.json
Original file line number Diff line number Diff line change
Expand Up @@ -6625,7 +6625,7 @@
"type": "TOKEN",
"content": {
"type": "PATTERN",
"value": "[0-9a-zA-Z]+"
"value": "[0-9a-zA-Z_-]+"
}
}
},
Expand Down Expand Up @@ -6665,7 +6665,7 @@
"type": "TOKEN",
"content": {
"type": "PATTERN",
"value": "[0-9a-zA-Z]+"
"value": "[0-9a-zA-Z_-]+"
}
}
},
Expand Down
Loading

0 comments on commit b0b330f

Please sign in to comment.