File: xhtmlparser.racc

package info (click to toggle)
rexical 1.0.8-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 316 kB
  • sloc: ruby: 1,124; makefile: 8; ansic: 5
file content (66 lines) | stat: -rw-r--r-- 1,307 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#
# xml parser
#

class XHTMLParser

rule
  target        : /* none */
                | xml_doc

  xml_doc       : xml_header  extra  xml_body
                | xml_header  xml_body
                | xml_body

  xml_header    : xtag_in  element  attributes  xtag_out

  xml_body      : tag_from  contents  tag_to

  tag_from      : tag_in  element  attributes  tag_out

  tag_empty     : tag_in  element  attributes  etag_out

  tag_to        : etag_in  element  tag_out

  attributes    : /* none */
                | attributes  attribute

  attribute     : attr  equal  quoted

  quoted        : quote1  value  quote1
                | quote2  value  quote2

  contents      : /* none */
                | contents  content

  content       : text
                | extra
                | tag_from  contents  tag_to
                | tag_empty

  extra         : tag_in  ext  extra_texts  tag_out

  extra_texts   : /* none */
                | extra_texts  rem_in  remtexts  rem_out
                | extra_texts  exttext

  remtexts      : remtext
                | remtexts  remtext

end

---- header ----
#
# generated by racc
#
require 'xhtmlparser.rex'
---- inner ----

---- footer ----

exit  if ARGV.size == 0
filename = ARGV.shift

htmlparser = XHTMLParser.new
htmlparser.scan_file  filename