diff --git a/.gitmodules b/.gitmodules index 470c77e6..64144255 100644 --- a/.gitmodules +++ b/.gitmodules @@ -800,3 +800,6 @@ [submodule "vendor/grammars/ABNF.tmbundle"] path = vendor/grammars/ABNF.tmbundle url = https://github.com/sanssecours/ABNF.tmbundle +[submodule "vendor/grammars/EBNF.tmbundle"] + path = vendor/grammars/EBNF.tmbundle + url = https://github.com/sanssecours/EBNF.tmbundle diff --git a/grammars.yml b/grammars.yml index ec8de806..806c1f95 100755 --- a/grammars.yml +++ b/grammars.yml @@ -22,6 +22,8 @@ vendor/grammars/ColdFusion: - text.html.cfm vendor/grammars/Docker.tmbundle: - source.dockerfile +vendor/grammars/EBNF.tmbundle: +- source.ebnf vendor/grammars/Elm/Syntaxes: - source.elm - text.html.mediawiki.elm-build-output diff --git a/lib/linguist/languages.yml b/lib/linguist/languages.yml index ce9685ba..6e6346a3 100755 --- a/lib/linguist/languages.yml +++ b/lib/linguist/languages.yml @@ -1029,6 +1029,15 @@ E: tm_scope: none ace_mode: text language_id: 92 +EBNF: + type: data + extensions: + - ".ebnf" + tm_scope: source.ebnf + ace_mode: text + codemirror_mode: ebnf + codemirror_mime_type: text/x-ebnf + language_id: 430 ECL: type: programming color: "#8a1267" diff --git a/samples/EBNF/grammar.ebnf b/samples/EBNF/grammar.ebnf new file mode 100644 index 00000000..bd2d2c3d --- /dev/null +++ b/samples/EBNF/grammar.ebnf @@ -0,0 +1,24 @@ +(* + Source: https://github.com/sunjay/lion + License: MIT +*) + +Statement = ( NamedFunction | AnonymousFunction | Assignment | Expr ) , "\n" ; +Expr = AnonymousFunction | Term | "(" , Expr , ")" , + { AnonymousFunction | Term | "(" , Expr , ")" } ; + +Assignment = Symbol , "=" , Expr ; + +AnonymousFunction = "\" , FunctionRHS ; +NamedFunction = Symbol , FunctionRHS ; + +FunctionRHS = FunctionParams , "=" , FunctionBody ; +FunctionParams = FunctionParam , { FunctionParam } ; +FunctionParam = Term ; +FunctionBody = Expr ; + +Term = Symbol | Number | SingleWordString ; +SingleWordString = '"' , Symbol , '"' ; +(* Symbol is a collection of valid symbol characters, not defined here *) +(* Number is a valid numeric literal *) + diff --git a/samples/EBNF/material.ebnf b/samples/EBNF/material.ebnf new file mode 100644 index 00000000..7e056d1e --- /dev/null +++ b/samples/EBNF/material.ebnf @@ -0,0 +1,40 @@ +(* + Source: https://github.com/io7m/jsom0 + License: ISC +*) + +name = + "name" , string , ";" ; + +diffuse = + "diffuse" , real , real , real , ";" ; + +ambient = + "ambient" , real , real , real , ";" ; + +specular = + "specular" , real , real , real , real , ";" ; + +shininess = + "shininess" , real , ";" ; + +alpha = + "alpha" , real , ";" ; + +mapping = + "map_chrome" | "map_uv" ; + +texture = + "texture" , string , real , mapping , ";" ; + +material = + "material" , ";" , + name , + diffuse , + ambient , + specular , + shininess , + alpha , + [ texture ] , + "end" , ";" ; + diff --git a/samples/EBNF/object.ebnf b/samples/EBNF/object.ebnf new file mode 100644 index 00000000..5282e3fc --- /dev/null +++ b/samples/EBNF/object.ebnf @@ -0,0 +1,61 @@ +(* + Source: https://github.com/io7m/jsom0 + License: ISC +*) + +vertex_p3n3_name = + "vertex_p3n3" ; + +vertex_p3n3t2_name = + "vertex_p3n3t2" ; + +vertex_type = + vertex_p3n3_name | vertex_p3n3t2_name ; + +vertex_position = + "position" , real , real , real , ";" ; + +vertex_normal = + "normal" , real , real , real , ";" ; + +vertex_uv = + "uv" , real , real , ";" ; + +vertex_p3n3 = + vertex_p3n3_name , vertex_position , vertex_normal , "end" , ";" ; + +vertex_p3n3t2 = + vertex_p3n3t2_name , vertex_position , vertex_normal , vertex_uv , "end" , ";" ; + +vertex = + vertex_p3n3 | vertex_p3n3t2 ; + +vertex_array = + "array" , positive , vertex_type , { vertex } , "end" , ";" ; + +vertices = + "vertices" , ";" , vertex_array , "end" , ";" ; + +triangle = + "triangle" , natural , natural , natural , ";" ; + +triangle_array = + "array" , positive, "triangle" , { triangle } , "end" , ";" ; + +triangles = + "triangles" , ";" , triangle_array , "end" , ";" ; + +name = + "name" , string , ";" ; + +material_name = + "material_name" , string , ";" ; + +object = + "object" , ";" , + name , + material_name , + vertices , + triangles , + "end" , ";" ; + diff --git a/samples/EBNF/types.ebnf b/samples/EBNF/types.ebnf new file mode 100644 index 00000000..23006bbb --- /dev/null +++ b/samples/EBNF/types.ebnf @@ -0,0 +1,20 @@ +(* + Source: https://github.com/io7m/jsom0 + License: ISC +*) + +digit_without_zero = + "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" ; + +digit = + "0" | digit_without_zero ; + +positive = + digit_without_zero , { digit } ; + +natural = + "0" | positive ; + +real = + [ "-" ] , digit , [ "." , { digit } ] ; + diff --git a/vendor/grammars/EBNF.tmbundle b/vendor/grammars/EBNF.tmbundle new file mode 160000 index 00000000..13efe915 --- /dev/null +++ b/vendor/grammars/EBNF.tmbundle @@ -0,0 +1 @@ +Subproject commit 13efe9156b74c97c0d6b3d1fa46d4ad839fa80e5 diff --git a/vendor/licenses/grammar/EBNF.tmbundle.txt b/vendor/licenses/grammar/EBNF.tmbundle.txt new file mode 100644 index 00000000..d8a1387e --- /dev/null +++ b/vendor/licenses/grammar/EBNF.tmbundle.txt @@ -0,0 +1,24 @@ +--- +type: grammar +name: EBNF.tmbundle +license: mit +--- +Copyright (C) 2012 by Arne Schroppe + +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.