1
0
Fork 0
mirror of https://github.com/Reuh/anselme.git synced 2025-10-27 16:49:31 +00:00

Change priority of _~?_, _~_, and _#_

This commit is contained in:
Étienne Fildadut 2022-01-16 00:35:52 +01:00
parent dc0b8f627c
commit b89095bbd2
2 changed files with 22 additions and 18 deletions

View file

@ -835,8 +835,9 @@ From lowest to highest priority:
_;_ _;
_:=_ _+=_ _-=_ _//=_ _/=_ _*=_ _%=_ _^=_
_,_
_~?_ _~_ _#_
_=_
_|_ _&_ _~?_ _~_ _#_
_|_ _&_
_!=_ _==_ _>=_ _<=_ _<_ _>_
_+_ _-_
_*_ _//_ _/_ _%_

View file

@ -5,19 +5,20 @@ local binops_prio = {
[1] = { ";" },
[2] = { ":=", "+=", "-=", "//=", "/=", "*=", "%=", "^=" },
[3] = { "," },
[4] = { "=" },
[5] = { "|", "&", "~?", "~", "#" },
[6] = { "!=", "==", ">=", "<=", "<", ">" },
[7] = { "+", "-" },
[8] = { "*", "//", "/", "%" },
[9] = { "::" },
[10] = {}, -- unary operators
[11] = { "^" },
[12] = { ".", "!" },
[13] = {}
[4] = { "~?", "~", "#" },
[5] = { "=" },
[6] = { "|", "&" },
[7] = { "!=", "==", ">=", "<=", "<", ">" },
[8] = { "+", "-" },
[9] = { "*", "//", "/", "%" },
[10] = { "::" },
[11] = {}, -- unary operators
[12] = { "^" },
[13] = { ".", "!" },
[14] = {}
}
local pair_priority = 4
local implicit_multiply_priority = 8.5 -- just above / so 1/2x gives 1/(2x)
local pair_priority = 5
local implicit_multiply_priority = 9.5 -- just above / so 1/2x gives 1/(2x)
-- unop priority
local prefix_unops_prio = {
[1] = {},
@ -29,10 +30,11 @@ local prefix_unops_prio = {
[7] = {},
[8] = {},
[9] = {},
[10] = { "-", "!" },
[11] = {},
[10] = {},
[11] = { "-", "!" },
[12] = {},
[13] = { "&" }
[13] = {},
[14] = { "&" }
}
local suffix_unops_prio = {
[1] = { ";" },
@ -46,8 +48,9 @@ local suffix_unops_prio = {
[9] = {},
[10] = {},
[11] = {},
[12] = { "!" },
[13] = {}
[12] = {},
[13] = { "!" },
[14] = {}
}
local function get_text_in_litteral(s, start_pos)