Fix for compiler not parenthesizing method targets, fix for parser not
recognizing \ line continuation, and improvements to upgrade tool API.
This commit is contained in:
parent
fdf7a537c8
commit
e7e84c9eda
@ -121,9 +121,9 @@ inline_action (Action):
|
|||||||
inline_arg: inline_expression / inline_block
|
inline_arg: inline_expression / inline_block
|
||||||
action (Action):
|
action (Action):
|
||||||
!section_division
|
!section_division
|
||||||
({:target: arg :} (eol nl_nodent "..")? ws* "::" (eol nl_nodent "..")? ws*)?
|
({:target: arg :} ((ws* "\")? eol nl_nodent "..")? ws* "::" ((ws* "\")? eol nl_nodent "..")? ws*)?
|
||||||
( (arg ((eol nl_nodent "..")? ws* (arg / word))+)
|
( (arg (((ws* "\")? eol nl_nodent "..")? ws* (arg / word))+)
|
||||||
/ (word ((eol nl_nodent "..")? ws* (arg / word))*))
|
/ (word (((ws* "\")? eol nl_nodent "..")? ws* (arg / word))*))
|
||||||
arg: expression / inline_block / indented_block
|
arg: expression / inline_block / indented_block
|
||||||
|
|
||||||
word: !number { operator_char+ / ident_char+ }
|
word: !number { operator_char+ / ident_char+ }
|
||||||
|
@ -1005,7 +1005,11 @@ do
|
|||||||
elseif "Action" == _exp_0 then
|
elseif "Action" == _exp_0 then
|
||||||
local nomsu = NomsuCode(tree.source)
|
local nomsu = NomsuCode(tree.source)
|
||||||
if tree.target then
|
if tree.target then
|
||||||
nomsu:append(self:tree_to_inline_nomsu(tree.target), "::")
|
local inline_target = self:tree_to_inline_nomsu(tree.target)
|
||||||
|
if tree.target.type == "Action" then
|
||||||
|
inline_target:parenthesize()
|
||||||
|
end
|
||||||
|
nomsu:append(inline_target, "::")
|
||||||
end
|
end
|
||||||
for i, bit in ipairs(tree) do
|
for i, bit in ipairs(tree) do
|
||||||
if type(bit) == "string" then
|
if type(bit) == "string" then
|
||||||
|
@ -631,7 +631,10 @@ with NomsuCompiler
|
|||||||
when "Action"
|
when "Action"
|
||||||
nomsu = NomsuCode(tree.source)
|
nomsu = NomsuCode(tree.source)
|
||||||
if tree.target
|
if tree.target
|
||||||
nomsu\append @tree_to_inline_nomsu(tree.target), "::"
|
inline_target = @tree_to_inline_nomsu(tree.target)
|
||||||
|
if tree.target.type == "Action"
|
||||||
|
inline_target\parenthesize!
|
||||||
|
nomsu\append inline_target, "::"
|
||||||
for i,bit in ipairs tree
|
for i,bit in ipairs tree
|
||||||
if type(bit) == "string"
|
if type(bit) == "string"
|
||||||
clump_words = (type(tree[i-1]) == 'string' and is_operator(bit) != is_operator(tree[i-1]))
|
clump_words = (type(tree[i-1]) == 'string' and is_operator(bit) != is_operator(tree[i-1]))
|
||||||
|
@ -10,22 +10,29 @@ use "lib/os.nom"
|
|||||||
|
|
||||||
%args = (command line args)
|
%args = (command line args)
|
||||||
%inplace = (no)
|
%inplace = (no)
|
||||||
if (%args.1 is "-i"):
|
%version = (Nomsu version)
|
||||||
|
repeat:
|
||||||
|
if %args.1 is:
|
||||||
|
"-i":
|
||||||
%inplace = (yes)
|
%inplace = (yes)
|
||||||
%args::remove index 1
|
%args::remove index 1
|
||||||
|
"-t":
|
||||||
if (%args.1 is "-t"):
|
|
||||||
use "lib/consolecolor.nom"
|
use "lib/consolecolor.nom"
|
||||||
%test = (yes)
|
%test = (yes)
|
||||||
%args::remove index 1
|
%args::remove index 1
|
||||||
|
"-V":
|
||||||
|
%version = %args.2
|
||||||
|
%args::remove index 1
|
||||||
|
%args::remove index 1
|
||||||
|
else: stop
|
||||||
|
|
||||||
for %path in %args:
|
for %path in %args:
|
||||||
for file %filename in %path:
|
for file %filename in %path:
|
||||||
unless (%filename::matches "%.nom$"): do next %filename
|
unless (%filename::matches "%.nom$"): do next %filename
|
||||||
%tree = (parse (read file %filename) from %filename)
|
%tree = (parse (read file %filename) from %filename)
|
||||||
%uptree = (%tree upgraded)
|
%uptree = (%tree upgraded to %version)
|
||||||
%text = "\
|
%text = "\
|
||||||
..#!/usr/bin/env nomsu -V\(Nomsu version)
|
..#!/usr/bin/env nomsu -V\%version
|
||||||
\(%uptree as nomsu)"
|
\(%uptree as nomsu)"
|
||||||
|
|
||||||
if:
|
if:
|
||||||
|
Loading…
Reference in New Issue
Block a user