Comments (7)
See also https://rust-leipzig.github.io/regex/2017/03/28/comparison-of-regex-engines/ and https://news.ycombinator.com/item?id=14608663
from uxsdcxx.
I don't think this would work. Even the non-requirement of order on the attributes will make the resulting regular expression explode combinatorially. Think of an element with 6 required attributes:
<element (attr1="([\w]*)" attr2="([\w]*)" attr3="([\w]*)" attr4="([\w]*)" attr5="([\w]*)" attr6="([\w]*)")
|(attr1="([\w]*)" attr2="([\w]*)" attr3="([\w]*)" attr4="([\w]*)" attr6="([\w]*)" attr5="([\w]*)"
| [718 more permutations...] >
from uxsdcxx.
Use an or and a match X times. Something like....
<element (attr1="([\w]*)"|attr2="([\w]*)"|attr3="([\w]*)")*>
from uxsdcxx.
Yes, but then we won't be checking if all required attributes are present. State machines are really bad at handling independent inputs.
from uxsdcxx.
@duck2 - That can be done after the tag has been parsed?
from uxsdcxx.
Need to think more. Maybe we could make something like an opinionated SAX parser out of this, output of which can be fed to the general purpose validators.
from uxsdcxx.
@duck2 Notice how I separated some final validation from the parsing in the example here -> #1 (comment)
from uxsdcxx.
Related Issues (20)
- Convert comments into docstrings HOT 1
- Use sorted(set) when you need ordered output HOT 2
- Make uxsdcxx.py pep8 clean
- Generate sane default values HOT 2
- Figure out if we can use POD data structures HOT 4
- Create a Captain Proto schema generator HOT 1
- Sort struct declarations in dependency order HOT 1
- Make lexing ARM-friendly
- Add memory freeing functions HOT 1
- Make an XML writer HOT 1
- Write a useful README
- Create a boost PropertyTree generator
- sequences accept the wrong inputs
- Load xml into capnp HOT 1
- Support true/false for boolean values
- Cull unused complex types
- Unstable output order HOT 1
- Replace master with interface-consumer
- Transfer this repo to SymbiFlow organization HOT 3
- Add license checking github action HOT 2
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 uxsdcxx.