https://github.com/wisn/format-preserving-yaml
A Format-Preserving YAML Parser
https://github.com/wisn/format-preserving-yaml
format-preserving gsoc-2018 haskell parser yaml-parser
Last synced: 7 days ago
JSON representation
A Format-Preserving YAML Parser
- Host: GitHub
- URL: https://github.com/wisn/format-preserving-yaml
- Owner: wisn
- License: bsd-3-clause
- Created: 2018-05-21T19:34:40.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-07-13T09:27:11.000Z (almost 8 years ago)
- Last Synced: 2025-11-10T16:26:18.917Z (8 months ago)
- Topics: format-preserving, gsoc-2018, haskell, parser, yaml-parser
- Language: Haskell
- Size: 59.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Format.Preserving.YAML
A format-preserving YAML parser.
## Progress Note
We are following the [YAML 1.2 Spec](http://yaml.org/spec/1.2/spec.html) in
general and use [Core Schema](http://yaml.org/spec/1.2/spec.html#id2804923) as
the reference for YAML native data structure in Haskell.
### Implementation
#### YAML Native Data Structure in Haskell
YAML supports multi-document content in one file. Each document could contains
Directive and Body (YAML Node).
```haskell
data YAML = YAML Documents
type Documents = [Document]
data Document = Document Directives Node
```
#### Finished Implementation
##### Directive
- Version Directive
- Tag Directive
- None-reserved YAML Directive
##### Scalar
- Comment
- Null
- Bool
- Int (base 16, base 10, base 8)
- Float including Inf and NaN
- Node Alias
##### Sequence
- Empty Sequence
- Single element Sequence
- Many elements Sequence
**TODO**: Investigate more tricky cases and add more tests.
#### Ongoing Implementation
##### Scalar
- Quoted Str (single, double)
- Node Anchor
##### Sequence
- Nested Sequence
**NOTE**: Fixing bugs. Implements parser for escaped character.
##### Miscellaneous
Constructing and researching about algorithm & data structure for block-scoped
indentation in YAML. This is the hardest part.
### Implementation Validation
I'm reading [Learn YAML in Y Minutes](https://learnxinyminutes.com/docs/yaml/)
to think about the implementation and looked at the YAML 1.2 Spec production
grammar for the best outcome. Making sure that the YAML is valid using online
[YAML Linter](http://www.yamllint.com/) and online
[YAML Parser](http://yaml-online-parser.appspot.com/). However, there are
several limitation in those YAML Linter and YAML Parser implementation. Hence,
we stick with the YAML 1.2 Spec to the end.
### Usage Example
Example will be added later. There are tests instead in `test/` directory.
## License
Licensed under [The BSD3 License](LICENSE).