Skip to main content

module lang::csv::\syntax::CSV

rascal-0.40.16

Usage

import lang::csv::\syntax::CSV;

syntax Table

start syntax Table 
= table: {Record EOL}*
;

syntax Record

syntax Record // todo: $ does match single \r 
= record: {Field ","}+
;

syntax Field

syntax Field
= unquoted: UQStr
| quoted: QStr
;

syntax UQStr

lexical UQStr
= ![\n\r\",] ![\n\r,]* !>> ![\n\r,]
| /* empty */
;

syntax QStr

lexical QStr
= [\"] QChar* [\"] !>> ![,\n\r]
;

syntax QChar

lexical QChar
= ![\"\n\r]
| [\"][\"]
;

syntax EOL

lexical EOL
= [\n]
| [\r][\n]
| [\r] !>> [\n]
;