lib/fig/grammar.treetop in fig-0.1.59 vs lib/fig/grammar.treetop in fig-0.1.61

- old
+ new

@@ -34,42 +34,42 @@ rule package_statement archive / resource / retrieve / config end rule archive - statement_start:"archive" ws url { + statement_start:"archive" ws resource_url { def to_package_statement(descriptor) Statement::Archive.new( - Parser.node_location(statement_start), url.value.text_value + Parser.node_location(statement_start), resource_url.value.text_value ) end } end rule resource - statement_start:"resource" ws url { + statement_start:"resource" ws resource_url { def to_package_statement(descriptor) Statement::Resource.new( - Parser.node_location(statement_start), url.value.text_value + Parser.node_location(statement_start), resource_url.value.text_value ) end } end rule retrieve - statement_start:"retrieve" ws var:retrieve_variable "->" path:retrieve_path ws { + statement_start:"retrieve" ws var:retrieve_variable_name "->" path:retrieve_path ws { def to_package_statement(descriptor) Statement::Retrieve.new( Parser.node_location(statement_start), var.text_value, path.text_value ) end } end - rule retrieve_variable + rule retrieve_variable_name [@a-zA-Z0-9/._]+ end rule retrieve_path [a-zA-Z0-9_/.\[\]-]+ @@ -118,47 +118,47 @@ end } end rule path - statement_start:("append" / "path" / "add") ws name:path_name "=" value:path_value ws { + statement_start:("append" / "path" / "add") ws name:environment_variable_name "=" value:path_value ws { def to_config_statement(descriptor) Statement::Path.new( Parser.node_location(statement_start), name.text_value, value.text_value ) end } end - rule path_name + rule environment_variable_name [a-zA-Z0-9_]+ end rule path_value - [@a-zA-Z0-9/\\._-]+ + # Characters blocked in the value: + # ;: - Windows/*nix path separators + # "<>| - Characters not allowed in filenames on Windows + # \s - Necessary for the "ws" token to work + [^;:"<>|\s]+ end rule set - statement_start:"set" ws name:set_name "=" value:set_value ws { + statement_start:"set" ws name:environment_variable_name "=" value:set_value ws { def to_config_statement(descriptor) Statement::Set.new( Parser.node_location(statement_start), name.text_value, value.text_value ) end } end - rule set_name - [a-zA-Z0-9_]+ - end - rule set_value - [@a-zA-Z0-9/\\._-]* + [\S]* end rule command statement_start:"command" ws string { def to_config_statement(descriptor) @@ -195,22 +195,35 @@ end } end rule package_name - [a-zA-Z0-9.-]+ + [a-zA-Z0-9_.-]+ end rule version_name [a-zA-Z0-9_.-]+ end rule config_name [a-zA-Z0-9_.-]+ end - rule url - (value:[a-zA-Z0-9:/\\._*-]+ ws) / ('"' value:[a-zA-Z0-9:/\\._-]+ '"' ws) + rule resource_url + # Unquoted allows globbing for files, quoted does not. + # + # Unquoted, anything but: + # @ - To allow for package substitution + # "<>| - Characters not allowed in filenames on Windows + # \s - Necessary for the "ws" token to work + (value:[^@"<>|\s]+ ws) + + # Unquoted, anything but: + # @ - To allow for package substitution + # "<>| - Characters not allowed in filenames on Windows + # *?\[\]{} - Characters significant to Dir.glob() + # \s - We just don't want these. :] (May need to allow space.) + / ('"' value:[^@"<>|*?\[\]{}\s]+ '"' ws) end rule ws [ \n\r\t]+ end