ref: 07e65a3a88e03c6d9e6f1f6ac4a1cfa9a74a9b09 mrsh/parser d---------
parser/arithm: fix && and ||

"&" and "|" have higher priority, so they were consuming the first character of
"&&" and "||", leaving a trailing "&" or "|".
parser/arithm: fix comparison operators

> and < were recognized before >= and <=. For this reason, >= and <= were never
parsed (since they are prefixes of < and >).

Closes: https://github.com/emersion/mrsh/issues/86
4bbbae2b — Pavel Shlyak 2 years ago
arithm.c: fix typos

ast: add mrsh_node

This adds mrsh_node_type to all AST nodes. This makes it possible to implement
operations over the whole tree much more easily.
Rename node to and_or_list

This is the term used by the spec.
parser: fail on invalid parameter

POSIX says '$' followed by an invalid character is unspecified behaviour. Make
the parser fail instead of handling it as a string.

This diverges from the dash implementation.

Fixes: aff5a58f0f99 ("parser: handle `$` followed by invalid char more gracefully")
parser: handle `$` followed by invalid char more gracefully

e.g. `$ ` and `$\n`

POSIX says it's undefined behaviour.

Closes: https://github.com/emersion/mrsh/issues/13
8660d8d0 — Cristian Adrián Ontivero 2 years ago
Accept spaces inside arithmetic expressions

Fixes #52.
d28f531c — Cristian Adrián Ontivero 2 years ago
Fix parser choking on certain arithmetic operators

Specifically '&', '|', '/', '<', and '>' in arithmetic expressions.
21468dfb — Cristian Adrián Ontivero 2 years ago
Rename *_func_t types to *_func

POSIX reserves the _t suffix, so it's advisable to avoid it.
7b4f77fa — Cristian Adrián Ontivero 2 years ago
Parse arithmetic expressions with shifts

We introduce the function arithmetic_word() to parse arithmetic
expressions instead of reusing the general word(), and generalize
word_list() to receive a pointer to function, so that word_list() may be
used to parse a list of whatever type of word we need.

This fixes #51, and enables properly parsing parenthesized expressions
inside arithmetic expressions, e.g. $(((2+1)-1)).
Add mrsh_get_alias
783dd27a — Pavel Shlyak 2 years ago
Fix typo

https://github.com/emersion/mrsh/issues/73 part 2
parser: fix io_number

Fixes https://github.com/emersion/mrsh/issues/64
Fix continuation lines in interactive mode
parser: add mrsh_parser_from_buffer

This allows the user to share a buffer with the parser. This is especially
useful when managing manually how input lines are read (e.g. for interactive
shells). Before each mrsh_parse_line call, the user can fill the shared buffer
with the (maybe incomplete) input.

Fixes https://github.com/emersion/mrsh/issues/59
Move away from FILE

Fixes https://github.com/emersion/mrsh/issues/58
parser: finish arithmetic expression parser
parser: add a few binary arithmetic operations
parser: parse arithmetic unop and parens