Comments (4)
Hey @mingodad from what I've seen and used, table captures in re
is there documented and working as expected, so I don't see any issues here. Also this repository is a mirror, and I don't think Roberto answers here, if you want an answer back you should ask questions or report issues in Lua mailing list, there more people will also be able to test and help.
Also make sure to be test this in pure LPeg library before reporting as LPeg issue (no LPegLabel or LPegRex forks).
from lpeg.
I'm not saying that it's not implemented, I'm saying that it's not in the documentation grammar of re, see it ammended reproduced here :
p = [=[
pattern <- exp !.
exp <- S (grammar / alternative)
alternative <- seq ('/' S seq)*
seq <- prefix*
prefix <- '&' S prefix / '!' S prefix / suffix
suffix <- primary S (([+*?]
/ '^' [+-]? num
/ '->' S (string / '{}' / name)
/ '=>' S name) S)*
primary <- '(' exp ')' / string / class / defined
/ '{:' (name ':')? exp ':}'
/ '=' name
/ '{}'
/ '{~' exp '~}'
/ '{|' exp '|}' --!!! <<< missing table capture
/ '{' exp '}'
/ '.'
/ name S !arrow
/ '<' name '>' -- old-style non terminals
grammar <- definition+
definition <- name S arrow exp
class <- '[' '^'? item (!']' item)* ']'
item <- defined / range / .
range <- . '-' [^]]
S <- (%s / '--' [^%nl]*)* -- spaces and comments
name <- [A-Za-z][A-Za-z0-9_]*
arrow <- '<-'
num <- [0-9]+
string <- '"' [^"]* '"' / "'" [^']* "'"
defined <- '%' name
]=]
print(re.match(p, p)) -- a self description must match itself
from lpeg.
Oh now I understand, indeed it is missing there. It an issue only in an example of the re documentation page then.
Still chances are higher of that being fixed if this gets reported in the Lua mailing list.
from lpeg.
The mentioned grammar also is missing an underscore for the first character of a name
that is in code and is accepted:
In the documentation:
name <- [A-Za-z][A-Za-z0-9_]*
In the code:
name <- [A-Za-z_][A-Za-z0-9_]*
from lpeg.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lpeg.