-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9141930
Showing
9 changed files
with
256 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
generated/*.cson | ||
generated/*.tmLanguage | ||
generated/*.scopes | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
In rough order of contribution: | ||
|
||
* Bruce Mitchener, Jr. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright (c) 2016 Bruce Mitchener, Jr. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a | ||
copy of this software and associated documentation files (the "Software"), | ||
to deal in the Software without restriction, including without limitation | ||
the rights to use, copy, modify, merge, publish, distribute, sublicense, | ||
and/or sell copies of the Software, and to permit persons to whom the | ||
Software is furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included | ||
in all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING | ||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | ||
IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# rdf-syntax-support | ||
|
||
This repository stores source files, build infrastructure, | ||
and tests for syntax definitions for various formats used | ||
for RDF data. | ||
|
||
These definitions are used to generate files that are accepted | ||
by: | ||
|
||
* [Visual Studio Code](https://code.visualstudio.com/) | ||
* [Atom](https://atom.io/) | ||
* [Sublime Text](http://www.sublimetext.com/) | ||
* [Textmate](https://macromates.com/) | ||
|
||
## Building | ||
|
||
First, install ``syntaxdev`` and any other required packages | ||
by running: | ||
|
||
npm install . | ||
|
||
Then to generate the syntax definitions: | ||
|
||
npm run build | ||
|
||
Or to run the tests: | ||
|
||
npm test | ||
|
||
## Contributing | ||
|
||
Many things are still missing and there's a lot to do! Feel | ||
free to dig in! | ||
|
||
* Add your name to the `CONTRIBUTORS.rst` file. | ||
* Make sure you add tests for your changes. | ||
* Submit a clean pull request (no merge commits, no extra | ||
commits, and keep changes restricted to the purpose of | ||
the commit). Do ask for help if needed at this stage. | ||
|
||
## Useful Reading | ||
|
||
* [Syntax definitions](http://docs.sublimetext.info/en/latest/extensibility/syntaxdefs.html) from Sublime Text Unofficial Documentation | ||
* [Scope naming conventions](https://manual.macromates.com/en/language_grammars#naming_convention) |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
{ | ||
"name": "rdf-syntax-support", | ||
"version": "0.1.0", | ||
"description": "RDF syntax file generation", | ||
"scripts": { | ||
"build": "npm run build-turtle", | ||
"build-turtle": "npm run build-turtle-plist && npm run build-turtle-cson && npm run build-turtle-scopes", | ||
"build-turtle-plist": "syntaxdev build-plist --in src/turtle.syntax.yaml --out generated/turtle.tmLanguage", | ||
"build-turtle-cson": "syntaxdev build-cson --in src/turtle.syntax.yaml --out generated/turtle.cson", | ||
"build-turtle-scopes": "syntaxdev scopes --syntax src/turtle.syntax.yaml > generated/turtle.scopes", | ||
"test": "npm run test-turtle", | ||
"test-turtle": "syntaxdev test --tests tests/**/*.ttl --syntax src/turtle.syntax.yaml" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/endoli/rdf-syntax-support.git" | ||
}, | ||
"keywords": [ | ||
"Syntax", | ||
"RDF" | ||
], | ||
"author": "Bruce Mitchener, Jr.", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/endoli/rdf-syntax-support/issues" | ||
}, | ||
"homepage": "https://github.com/endoli/rdf-syntax-support#readme", | ||
"devDependencies": { | ||
"syntaxdev": "0.0.11" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
--- | ||
name: rdf-turtle | ||
scopeName: text.rdf.turtle | ||
fileTypes: [ttl] | ||
|
||
# [1] turtleDoc ::= statement* | ||
patterns: | ||
- include: '#statement' | ||
- include: '#comment' | ||
|
||
repository: | ||
comment: | ||
patterns: | ||
- include: '#line-comment' | ||
|
||
line-comment: | ||
name: comment.line.rdf.turtle | ||
begin: (#) | ||
end: $ | ||
beginCaptures: | ||
'1': {name: punctuation.definition.comment.rdf.turtle} | ||
|
||
statement: | ||
comment: "[2] statement ::= directive | triples '.'" | ||
patterns: | ||
- include: '#directive' | ||
- include: '#triples' | ||
|
||
directive: | ||
comment: "[3] directive ::= prefixID | base | sparqlPrefix | sparqlBase" | ||
patterns: | ||
- include: '#prefix_directive' | ||
- include: '#base_directive' | ||
- include: '#sparql_prefix_directive' | ||
- include: '#sparql_base_directive' | ||
|
||
prefix_directive: | ||
comment: "[4] prefixID ::= '@prefix' PNAME_NS IRIREF '.'" | ||
match: (@prefix) (\w*:) (<[^<>"{}|^`\]|\\]*>) (\.) | ||
captures: | ||
'1': {name: keyword.control.prefix.turtle} | ||
'2': {name: constant.turtle} | ||
'3': {name: string.uri.turtle} | ||
'4': {name: punctuation.end.turtle} | ||
|
||
base_directive: | ||
comment: "[5] base ::= '@base' IRIREF '.'" | ||
match: (@base) (<[^<>"{}|^`\]|\\]*>) (\.) | ||
captures: | ||
'1': {name: keyword.control.base.turtle} | ||
'2': {name: string.uri.turtle} | ||
'3': {name: punctuation.end.turtle} | ||
|
||
sparql_base_directive: | ||
comment: '[5s] sparqlBase ::= "BASE" IRIREF' | ||
match: (BASE) (<[^<>"{}|^`\]|\\]*>) | ||
captures: | ||
'1': {name: keyword.control.base.turtle} | ||
'2': {name: string.uri.turtle} | ||
|
||
sparql_prefix_directive: | ||
comment: '[6s] sparqlPrefix ::= "PREFIX" PNAME_NS IRIREF' | ||
match: (PREFIX) (\w*:) (<[^<>"{}|^`\]|\\]*>) | ||
captures: | ||
'1': {name: keyword.control.prefix.turtle} | ||
'2': {name: constant.turtle} | ||
'3': {name: string.uri.turtle} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# A comment | ||
# A comment with # another comment. | ||
|
||
|
||
|
||
|
||
# : comment.line.rdf.turtle, punctuation.definition.comment.rdf.turtle, text.rdf.turtle | ||
A comment : comment.line.rdf.turtle, text.rdf.turtle | ||
# : comment.line.rdf.turtle, punctuation.definition.comment.rdf.turtle, text.rdf.turtle | ||
A comment with # another comment. : comment.line.rdf.turtle, text.rdf.turtle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
@base <http://example.org/> . | ||
@base <http://example.org/> . # With a comment | ||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . | ||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . | ||
@prefix foaf: <http://xmlns.com/foaf/0.1/> . # Comment? | ||
@prefix rel: <http://www.perceive.net/schemas/relationship/> . | ||
@prefix : <http://example.com/> . | ||
BASE <http://another.example.org/> | ||
BASE <http://another.example.org/> # Comment! | ||
PREFIX p: <http://two.example/> | ||
|
||
|
||
|
||
@base : keyword.control.base.turtle, text.rdf.turtle | ||
: text.rdf.turtle | ||
<http://example.org/> : string.uri.turtle, text.rdf.turtle | ||
: text.rdf.turtle | ||
. : punctuation.end.turtle, text.rdf.turtle | ||
@base : keyword.control.base.turtle, text.rdf.turtle | ||
: text.rdf.turtle | ||
<http://example.org/> : string.uri.turtle, text.rdf.turtle | ||
: text.rdf.turtle | ||
. : punctuation.end.turtle, text.rdf.turtle | ||
: text.rdf.turtle | ||
# : comment.line.rdf.turtle, punctuation.definition.comment.rdf.turtle, text.rdf.turtle | ||
With a comment : comment.line.rdf.turtle, text.rdf.turtle | ||
@prefix : keyword.control.prefix.turtle, text.rdf.turtle | ||
: text.rdf.turtle | ||
rdf: : constant.turtle, text.rdf.turtle | ||
: text.rdf.turtle | ||
<http://www.w3.org/1999/02/22-rdf-syntax-ns#> : string.uri.turtle, text.rdf.turtle | ||
: text.rdf.turtle | ||
. : punctuation.end.turtle, text.rdf.turtle | ||
@prefix : keyword.control.prefix.turtle, text.rdf.turtle | ||
: text.rdf.turtle | ||
rdfs: : constant.turtle, text.rdf.turtle | ||
: text.rdf.turtle | ||
<http://www.w3.org/2000/01/rdf-schema#> : string.uri.turtle, text.rdf.turtle | ||
: text.rdf.turtle | ||
. : punctuation.end.turtle, text.rdf.turtle | ||
@prefix : keyword.control.prefix.turtle, text.rdf.turtle | ||
: text.rdf.turtle | ||
foaf: : constant.turtle, text.rdf.turtle | ||
: text.rdf.turtle | ||
<http://xmlns.com/foaf/0.1/> : string.uri.turtle, text.rdf.turtle | ||
: text.rdf.turtle | ||
. : punctuation.end.turtle, text.rdf.turtle | ||
: text.rdf.turtle | ||
# : comment.line.rdf.turtle, punctuation.definition.comment.rdf.turtle, text.rdf.turtle | ||
Comment? : comment.line.rdf.turtle, text.rdf.turtle | ||
@prefix : keyword.control.prefix.turtle, text.rdf.turtle | ||
: text.rdf.turtle | ||
rel: : constant.turtle, text.rdf.turtle | ||
: text.rdf.turtle | ||
<http://www.perceive.net/schemas/relationship/> : string.uri.turtle, text.rdf.turtle | ||
: text.rdf.turtle | ||
. : punctuation.end.turtle, text.rdf.turtle | ||
@prefix : keyword.control.prefix.turtle, text.rdf.turtle | ||
: text.rdf.turtle | ||
: : constant.turtle, text.rdf.turtle | ||
: text.rdf.turtle | ||
<http://example.com/> : string.uri.turtle, text.rdf.turtle | ||
: text.rdf.turtle | ||
. : punctuation.end.turtle, text.rdf.turtle | ||
BASE : keyword.control.base.turtle, text.rdf.turtle | ||
: text.rdf.turtle | ||
<http://another.example.org/> : string.uri.turtle, text.rdf.turtle | ||
BASE : keyword.control.base.turtle, text.rdf.turtle | ||
: text.rdf.turtle | ||
<http://another.example.org/> : string.uri.turtle, text.rdf.turtle | ||
: text.rdf.turtle | ||
# : comment.line.rdf.turtle, punctuation.definition.comment.rdf.turtle, text.rdf.turtle | ||
Comment! : comment.line.rdf.turtle, text.rdf.turtle | ||
PREFIX : keyword.control.prefix.turtle, text.rdf.turtle | ||
: text.rdf.turtle | ||
p: : constant.turtle, text.rdf.turtle | ||
: text.rdf.turtle | ||
<http://two.example/> : string.uri.turtle, text.rdf.turtle |