Skip to content

Commit

Permalink
Merge pull request #94 from metadave/dp_identifiers_with_dashes
Browse files Browse the repository at this point in the history
allow identifiers to contain "-"
  • Loading branch information
sunng87 committed Aug 3, 2016
2 parents 4b5b0e8 + 16128ef commit f1d4eb1
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/grammar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ impl_rdp! {
object_literal = { ["{"] ~ (string_literal ~ [":"] ~ literal)? ~ ([","] ~ string_literal ~ [":"] ~ literal)* ~ ["}"] }

// FIXME: a[0], a["b]
symbol_char = _{ ['a'..'z']|['A'..'Z']|['0'..'9']|["_"]|["."]|["@"]|["$"]|["<"]|[">"] }
symbol_char = _{ ['a'..'z']|['A'..'Z']|['0'..'9']|["_"]|["."]|["@"]|["$"]|["<"]|[">"]|["-"] }
path_char = _{ ["/"] }

identifier = @{ symbol_char ~ ( symbol_char | path_char )* }
Expand Down Expand Up @@ -211,6 +211,18 @@ fn test_helper_expression() {
}
}


#[test]
fn test_identifier_with_dash() {
let s = vec!["{{exp-foo}}"];
for i in s.iter() {
let mut rdp = Rdp::new(StringInput::new(i));
assert!(rdp.expression());
assert!(rdp.end());
}
}


#[test]
fn test_html_expression() {
let s = vec!["{{{html}}}", "{{{(html)}}}", "{{{(html)}}}"];
Expand Down

0 comments on commit f1d4eb1

Please sign in to comment.