File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 114114 $varName = $script :luaString.Substring ($identStart , $script :luaPos - $identStart )
115115
116116 # Lua grammar: variable names cannot be reserved words (§3.1)
117- if ($varName -in $reservedWords ) {
117+ if ($varName -cin $reservedWords ) {
118118 if ($script :luaSkipValidation ) {
119119 Write-Warning " Reserved word '$varName ' used as a variable name at position $identStart ."
120120 } else {
Original file line number Diff line number Diff line change 8787 if ($script :luaPos -lt $script :luaString.Length -and
8888 $script :luaString [$script :luaPos ] -eq ' =' ) {
8989 # Lua grammar: Name cannot be a reserved word (§3.1)
90- if ($ident -in $reservedWords ) {
90+ if ($ident -cin $reservedWords ) {
9191 if ($script :luaSkipValidation ) {
9292 Write-Warning " Reserved word '$ident ' used as a bare identifier key at position $identStart ."
9393 } else {
Original file line number Diff line number Diff line change @@ -522,6 +522,17 @@ B = { val = 2 }
522522 $result [' while' ] | Should - Be 2
523523 }
524524
525+ It ' Allows capitalized reserved words as bare table keys (Lua keywords are case-sensitive)' {
526+ $result = ConvertFrom-Lua - InputObject ' { End = 1, While = "loop" }' - AsHashtable
527+ $result [' End' ] | Should - Be 1
528+ $result [' While' ] | Should - Be ' loop'
529+ }
530+
531+ It ' Allows capitalized reserved words as assignment variable names (Lua keywords are case-sensitive)' {
532+ $result = ConvertFrom-Lua - InputObject ' End = 1' - AsHashtable
533+ $result [' End' ] | Should - Be 1
534+ }
535+
525536 It ' Throws on reserved word as assignment variable name' {
526537 { ConvertFrom-Lua - InputObject ' end = 1' } | Should - Throw ' *Reserved word*'
527538 }
You can’t perform that action at this time.
0 commit comments