diff --git a/src/advanced-poe-filter.pegjs b/src/advanced-poe-filter.pegjs index b29620d..9b92047 100644 --- a/src/advanced-poe-filter.pegjs +++ b/src/advanced-poe-filter.pegjs @@ -188,7 +188,7 @@ conditionValueNumericAndArray = pre:((numOperator __ num __) / (matchOperator __ } } conditionValueNumber = operator:numOperator __ num:num { return { ope: operator, val: num } } -conditionValueSocketType = operator:(numOperator __)? num:(num)? socketType:socketType { return operator ? { ope: operator[0], val: `${num ? num : ''}${socketType}` } : { ope: '=', val: `${num ? num : ''}${socketType}` } } +conditionValueSocketType = operator:(numOperator __)? num:(num)? socketTypes:socketTypes { return operator ? { ope: operator[0], val: `${num ? num : ''}${socketTypes}` } : { ope: '=', val: `${num ? num : ''}${socketTypes}` } } conditionValueRarity = operator:(numOperator __)? rarity:rarity { return operator ? { ope: operator[0], val: rarity } : { ope: '=', val: rarity } } conditionValueBoolean = boolean conditionValueImplicitModTier = operator:numOperator __ modTier:implicitModTier { return { ope: operator, val: modTier } } @@ -278,7 +278,12 @@ color = r:rgbaNum __ g:rgbaNum __ b:rgbaNum alpha:(__ rgbaNum)? { return { rgb: numOperator = '<=' / '>=' / '<' / '>' / '=' matchOperator = '==' / '=' rarity = 'Normal' / 'Magic' / 'Rare' / 'Unique' -socketType = $('R'* 'G'* 'B'* 'W'* 'A'* 'D'*) +socketType = 'R' / 'G' / 'B' / 'W' / 'A' / 'D' +socketTypes = vals:socketType|1..6| { + const order = ['R', 'G', 'B', 'W', 'A', 'D'] + return vals.sort((left, right) => order.indexOf(left) - order.indexOf(right)).join('') +} + rgbaNum = num:num &{ return 0 <= num && num <= 255 } { return num } implicitModTier = val:('1' / '2' / '3' / '4' / '5' / '6' / 'Lesser' / 'Greater' / 'Grand' / 'Exceptional' / 'Exquisite' / 'Perfect') { switch (val) { diff --git a/test/parser.test.js b/test/parser.test.js index b01648d..d41ad91 100644 --- a/test/parser.test.js +++ b/test/parser.test.js @@ -116,7 +116,7 @@ Show "Section1" Quality = 15 LinkedSockets = 6 Sockets >= 5RGBWAD - SocketGroup >= 5RGBWAD + SocketGroup >= 5ADRGBW Rarity = Rare BaseDefencePercentile > 50 BaseArmour > 40 @@ -161,7 +161,7 @@ Show "Section2" Class "Life Flasks" "Mana Flasks" "Hybrid Flasks" BaseType "Two-Toned Boots" "Spiked Gloves" "Gripped Gloves" "Fingerless Silk Gloves" "Bone Helmet" Sockets 5RGBWAD - SocketGroup 5RGBWAD + SocketGroup 5ADRGBW Rarity Rare HasExplicitMod == "Foo" "Bar" HasEaterOfWorldsImplicit >= Greater @@ -178,7 +178,7 @@ Show "Section2" PlayEffect Blue Temp Show "Section3" Sockets RGBWAD - SocketGroup RGBWAD + SocketGroup ADRGBW HasExplicitMod >= 2 "Foo" "Bar" HasEnchantment >= 2 "Foo" "Bar" HasInfluence None