# About this document
## Conventions
* Formats are formatted as `code`
* `[` and `]` literals are used to indicate character groups. E.g., `[\r\n]` for a newline, `[A-Z]` for any capital letter
* `(` and `)` are used for capture groups. E.g., `([A-Z])([0-9])` for a capital letter followed by a digit
* `*` after a group indicates zero or more repetitions. E.g., `([A-Z])([0-9])*` for a capital letter followed by zero or more digits
* `+` after a group indicates one or more repetitions. E.g., `([A-Z])([0-9])+` for a capital letter followed by one or more digits
* `?` after a group indicates zero or one repetitions. E.g., `([A-Z])([0-9])?` for a capital letter followed by zero or one digits
* Single quotes are used to indicate literals within formats. E.g., `'/*'` for a block comment start literal
* `.` is used to represent any non-whitespace character
* (not sure if using yet...) `{` and `}` are used for rule or value groups. E.g., `name('.' property)` to indicate a
# FML Format and Questions
* Token types
* Parser/lexer literals (for discrimination)
* Note that these do not include the single quotes for clarity here. When used in rules, these literals appear inside single quotes.
* `//` or `// `
* Used by:
* Line Comment
* Questions:
* Is whitespace required, or is a third slash prohibited
* `/*` and `*/`
* Used by:
* Block comment
* `///` or `/// `
* Used by:
* Metadata declaration
* Questions:
* Is a trailing whitespace required? E.g., is `///name='test'` valid?
* `=`
* Used by:
* Metadata declaration
* `"""`
* Used by:
* Metadata declaration (markdown values only)
* Parser/lexer types
* FHIR element name
* Used by:
* Metadata: `name`
* Metadata: `property`
* Candidates from current definitions
* FML ID: `([A-Za-z])([A-Za-z0-9])*`
* FHIRPath IDENTIFIER: `([A-Za-z] | '_')([A-Za-z0-9] | '_')*`
* Representative FHIR type
* code
* Comments
* Line comment: `'//' [.*][\r\n]`
* Start token is `//` literal
* Stop token is newline (`[\r\n]`)
* Start token means comment until newline token
* Can be standalone on line (applies to next token)
* Can repeat - repetitions apply as a group where any single would
* Can be after term - continues until newline (applies to previous token)
* Issue: disambiguation with triple slash
* Block comment: `/* [[.\r\n]*] */`
* Start token is `/*` literal
* Stop token is `*/` literal
* Start token means comment until stop token
* Can be standalont on line (applies to next token)
* Can contain multiple lines (single comment)
* Can repeat - repetitions apply as a group where any single would
* Can be after term (applies to previous token)
* Questions:
* Are these allowed in *any* whitespace (i.e., match with FHIRpath)?
* File Structure
* Metadata Declarations (0..*)
* Embedded Concept Map Declsarations (0..*)
* Questions:
* Is the file ordered or arbitrary?
* Metadata Declaration
* Format: `'///' name{.property}* '=' {value}`
* Start token is `///` literal
* Question - is this required to be `/// ` (with trailing space)?
* Stop token is newline
* Question - can the FHIRPath token (value) contain newlines?
* Start token means metadata declaration until newline
* The path specifier of `name{.property}*` is a qualified identifier in other parts of spec
* Question - if a choice type is used, is this expanded to 'valueCanonical' or 'value[x]'?
* Notes about value from spec:
* The value is a literal representation of the primitive value in FHIRPath format.
* Extensions are not supported
* The value for a complex element is empty
* Format: `/// [qualified identifier] = """[\r\n][[.\r\n]*][\r\n]"""`
* Start token is `///` literal
* Question - is this required to be `/// ` (with trailing space)?
* Stop token is `"""` literal
* Question - does this need to be alone on the line, start of line, etc?
* Question - can a comment appear after this?
* Start token means metatada declaration of markdown content until stop token
* Embedded ConceptMap declaration (not described in spec)
* Format: `conceptmap {url} '{' (conceptMapPrefix)+ (conceptMapCodeMap)+ '}'`
* `conceptMapPrefix`
* Fomat: `prefix name} = {url}`
* Structure Definition References
*