Hello everyone!
I'm writing a simple xml parser with Javascript, but i have some problems
matching markupdecl because of elementdecl
markupdecl ::= elementdecl | AttlistDecl | EntityDecl | NotationDecl | PI |
Comment
elementdecl is not a regular expression because of its circular procedure:
children ::= (choice | seq) ('?' | '*' | '+')?
cp ::= (Name | choice | seq) ('?' | '*' | '+')?
choice ::= '(' S? cp ( S? '|' S? cp )* S? ')'
seq ::= '(' S? cp ( S? ',' S? cp )* S? ')'
elementdecl -contentspec -children -choice | seq -cp -choice | seq
etc.
Since elementdecl is not a regular expression, markupdecl cannot be either
:(
How to resolve the definitions of choice, seq and cp with regular
expression?
I have to match element without capture it.
Thanks,
Max 3 1027
Max wrote:
Hello everyone!
I'm writing a simple xml parser with Javascript, but i have some problems
matching markupdecl because of elementdecl
markupdecl ::= elementdecl | AttlistDecl | EntityDecl | NotationDecl | PI |
Comment
elementdecl is not a regular expression because of its circular procedure:
children ::= (choice | seq) ('?' | '*' | '+')?
cp ::= (Name | choice | seq) ('?' | '*' | '+')?
choice ::= '(' S? cp ( S? '|' S? cp )* S? ')'
seq ::= '(' S? cp ( S? ',' S? cp )* S? ')'
elementdecl -contentspec -children -choice | seq -cp -choice | seq
etc.
Since elementdecl is not a regular expression, markupdecl cannot be either
Then you will have to give up having a token for element decls, and use
a nonterminal instead.
Make nonterminals for choice, seq etc too, since they are not regular
either.
BTW, I have made a javacc DTD parser. Mail me if you want it.
Søren This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Anand Pillai |
last post by:
To search a word in a group of words, say a paragraph or a web page,
would a string search or a regexp search be faster?
The string search would of course be,
if str.find(substr) != -1:...
|
by: Lukas Holcik |
last post by:
Hi everyone!
How can I simply search text for regexps (lets say <a
href="(.*?)">(.*?)</a>) and save all URLs(1) and link contents(2) in a
dictionary { name : URL}? In a single pass if it could....
|
by: Chris Croughton |
last post by:
I'm trying to use the EXSLT regexp package from
http://www.exslt.org/regexp/functions/match/index.html
(specifically the match function) with the libxml xltproc (which
supports EXSLT), but...
|
by: Jon Maz |
last post by:
Hi All,
I want to strip the accents off characters in a string so that, for example,
the (Spanish) word "práctico" comes out as "practico" - but ignoring case,
so that "PRÁCTICO" comes out as...
|
by: Dmitry Korolyov |
last post by:
ASP.NET app using c# and framework version 1.1.4322.573 on a IIS 6.0 web server.
A single-line asp:textbox control and regexp validator attached to it.
^\d+$ expression does match an empty...
|
by: Matt Kruse |
last post by:
Are there any current browsers that have Javascript support, but not RegExp
support?
For example, cell phone browsers, blackberrys, or other "minimal" browsers?
I know that someone using Netscape...
|
by: Csaba Gabor |
last post by:
I need to come up with a function
function regExpPos (text, re, parenNum) { ... }
that will return the position within text of RegExp.$parenNum if there
is a match, and -1 otherwise.
For...
|
by: conan |
last post by:
This regexp
'<widget class=".*" id=".*">'
works well with 'grep' for matching lines of the kind
<widget class="GtkWindow" id="window1">
on a XML .glade file
However that's not true for the...
|
by: Matt |
last post by:
Hello all,
I have just discovered (the long way) that using a RegExp object with
the 'global' flag set produces inconsistent results when its test()
method is executed. I realize that 'global'...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |