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

Change _=_ pair operator priority

This commit is contained in:
Étienne Fildadut 2022-01-16 00:19:09 +01:00
parent 311ff83d59
commit 86862be9f5

View file

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