Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arith #12

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/AST.ml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ and word_component =
| WTildePrefix of string
| WLiteral of string
| WDoubleQuoted of word
| WArith of word
| WVariable of name * attribute
| WSubshell of program
| WGlobAll
Expand Down
4 changes: 4 additions & 0 deletions src/CST_to_AST.ml
Original file line number Diff line number Diff line change
Expand Up @@ -772,6 +772,8 @@ and word_component__to__word = function
[AST.WTildePrefix prefix]
| WordLiteral literal ->
[AST.WLiteral literal]
| WordArith word ->
[AST.WArith (word__to__word word)]
| WordAssignmentWord (Name name, Word (_, word_cst)) ->
[AST.WLiteral name; AST.WLiteral "="]
@ word_cst__to__word word_cst
Expand Down Expand Up @@ -799,6 +801,8 @@ and word_component_double_quoted__to__word = function
[]
| WordName literal | WordLiteral literal | WordTildePrefix literal ->
[AST.WLiteral literal]
| WordArith word ->
[AST.WArith (word__to__word word)]
| WordSubshell (_, program') ->
[AST.WSubshell (program'__to__program program')]
| WordAssignmentWord (Name name, Word (_, word_cst)) ->
Expand Down
2 changes: 2 additions & 0 deletions src/safePrinter.ml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ let rec pp_name ppf =
and pp_word_component ppf = function (*FIXME*)
| WLiteral literal ->
fpf ppf "%s" literal
| WArith word ->
fpf ppf "$((%a))" pp_word word
| WTildePrefix _ ->
assert false
| WDoubleQuoted _word ->
Expand Down