1
0
Fork 0
mirror of https://github.com/Reuh/anselme.git synced 2025-10-28 00:59: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] = { ";" }, [1] = { ";" },
[2] = { ":=", "+=", "-=", "//=", "/=", "*=", "%=", "^=" }, [2] = { ":=", "+=", "-=", "//=", "/=", "*=", "%=", "^=" },
[3] = { "," }, [3] = { "," },
[4] = { "=" }, [4] = { "~?", "~", "#" },
[5] = { "|", "&", "~?", "~", "#" }, [5] = { "=" },
[6] = { "!=", "==", ">=", "<=", "<", ">" }, [6] = { "|", "&" },
[7] = { "+", "-" }, [7] = { "!=", "==", ">=", "<=", "<", ">" },
[8] = { "*", "//", "/", "%" }, [8] = { "+", "-" },
[9] = { "::" }, [9] = { "*", "//", "/", "%" },
[10] = {}, -- unary operators [10] = { "::" },
[11] = { "^" }, [11] = {}, -- unary operators
[12] = { ".", "!" }, [12] = { "^" },
[13] = {} [13] = { ".", "!" },
[14] = {}
} }
local pair_priority = 4 local pair_priority = 5
local implicit_multiply_priority = 8.5 -- just above / so 1/2x gives 1/(2x) local implicit_multiply_priority = 9.5 -- just above / so 1/2x gives 1/(2x)
-- unop priority -- unop priority
local prefix_unops_prio = { local prefix_unops_prio = {
[1] = {}, [1] = {},
@ -29,10 +30,11 @@ local prefix_unops_prio = {
[7] = {}, [7] = {},
[8] = {}, [8] = {},
[9] = {}, [9] = {},
[10] = { "-", "!" }, [10] = {},
[11] = {}, [11] = { "-", "!" },
[12] = {}, [12] = {},
[13] = { "&" } [13] = {},
[14] = { "&" }
} }
local suffix_unops_prio = { local suffix_unops_prio = {
[1] = { ";" }, [1] = { ";" },
@ -46,8 +48,9 @@ local suffix_unops_prio = {
[9] = {}, [9] = {},
[10] = {}, [10] = {},
[11] = {}, [11] = {},
[12] = { "!" }, [12] = {},
[13] = {} [13] = { "!" },
[14] = {}
} }
local function get_text_in_litteral(s, start_pos) local function get_text_in_litteral(s, start_pos)