mirror of
https://github.com/fluencelabs/lalrpop
synced 2025-03-16 17:00:53 +00:00
Added module_annotation to grammar
This commit is contained in:
parent
8b0b06965c
commit
72d8efcc00
@ -26,6 +26,7 @@ pub struct Grammar {
|
||||
pub where_clauses: Vec<String>,
|
||||
pub items: Vec<GrammarItem>,
|
||||
pub annotations: Vec<Annotation>,
|
||||
pub module_annotations: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
|
||||
|
@ -9,6 +9,7 @@ use util::strip;
|
||||
grammar<'input>(text: &'input str);
|
||||
|
||||
pub Grammar: Grammar =
|
||||
<module_annotations:ShebangAttribute*>
|
||||
<uses:Use*>
|
||||
<annotations:Annotation*>
|
||||
<lo:@L> "grammar" <hi:@R>
|
||||
@ -30,7 +31,8 @@ pub Grammar: Grammar =
|
||||
parameters: parameters.unwrap_or(vec![]),
|
||||
where_clauses: where_clauses,
|
||||
items: uses.into_iter().chain(items).collect(),
|
||||
annotations: annotations }
|
||||
annotations: annotations,
|
||||
module_annotations: module_annotations }
|
||||
};
|
||||
|
||||
GrammarTypeParameters: Vec<TypeParameter> =
|
||||
@ -361,6 +363,9 @@ Comma<E>: Vec<E> =
|
||||
<v0:(<E> ",")*> <e1:E?> =>
|
||||
v0.into_iter().chain(e1).collect();
|
||||
|
||||
ShebangAttribute: String =
|
||||
<s:"#![...]"> => s.to_string();
|
||||
|
||||
extern {
|
||||
type Location = usize;
|
||||
type Error = tok::Error;
|
||||
|
Loading…
x
Reference in New Issue
Block a user