lib/hemingway/latex.treetop in hemingway-0.0.2 vs lib/hemingway/latex.treetop in hemingway-0.0.3
- old
+ new
@@ -32,20 +32,20 @@
# - Okay so this is interesting. When you reference something with a * or
# a +, then you're creating a top level array-like structure that you'll
# have to dig past to get at the list. elements[0] refers to the array of
# tags or texts here.
rule paragraph
- sequence:( content / footnote )* eop <ParagraphNode>
+ sequence:( content / footnote / !eop newline )* eop <ParagraphNode>
end
# The last paragraph in an entry need not end with \n\n. Because this
# comes second in the ordered choice for entry, it will only be used
# if a paragraph has concluded for some reason and there wasn't an eop
# to consume. The only time I can imagine this happening would be at
# the end of an entry.
rule last_paragraph
- sequence:( content / footnote )+ eop? <ParagraphNode>
+ sequence:( content / footnote / !eop newline )+ eop? <ParagraphNode>
end
# Example: \tag{text} or just text or $\Delta$
# Notes:
# - So I can define methods based on the ordered choice in the top
@@ -56,11 +56,11 @@
special / tag / block / math / text
end
# Treetop does not separate lexing from parsing. Must consume all input.
rule whitespace
- ( " " / newline )*
+ ( " " / newline )+ <WhitespaceNode>
end
rule spaces
( " " )*
end
@@ -72,10 +72,10 @@
rule eop
newline 2..
end
rule newline
- "\n"
+ "\n" <NewlineNode>
end
end
end
\ No newline at end of file