Hello,
I'm playing with LPeg and lot of things around.
I started to test your sh-parser that seems really cool.
I see shell's comment is not managed like the rest of the body
My shell sample is
# comment 1
FOO=foo
# comment 2
BAR=bar
The parsed result is
t = {
["body"] = {
[1] = {
["type"] = "SimpleCommand",
["prefix"] = {
[1] = {
["type"] = "Assignment",
["value"] = {
["type"] = "Word",
["content"] = {
[1] = "foo",
},
},
["name"] = {
["type"] = "Name",
["text"] = "FOO",
},
},
},
},
[2] = {
["type"] = "SimpleCommand",
["prefix"] = {
[1] = {
["type"] = "Assignment",
["value"] = {
["type"] = "Word",
["content"] = {
[1] = "bar",
},
},
["name"] = {
["type"] = "Name",
["text"] = "BAR",
},
},
},
},
["__comment"] = {
["type"] = "Comment",
["text"] = " comment 2",
},
},
["type"] = "Program",
}
- Is it wanted ?
- why not processing comment like any other shell command ?
I would like to get something like :
t = {
["body"] = {
[1] = {type= "SimpleCommand", ...},
[2] = {type= "Comment", ...},
[3] = {type= "SimpleCommand", ...},
[4] = {type= "Comment", ...},
},
["type"] = "Program",
}
Hello,
I'm playing with LPeg and lot of things around.
I started to test your sh-parser that seems really cool.
I see shell's
commentis not managed like the rest of the bodyMy shell sample is
The parsed result is
I would like to get something like :