Browse Source

Initial source import

tags/v0.1.0
jubianchi 4 years ago
parent
commit
6213f002cf
9 changed files with 384 additions and 0 deletions
  1. +3
    -0
      .gitignore
  2. +3
    -0
      CHANGELOG.md
  3. +30
    -0
      LICENSE.md
  4. +41
    -0
      coffeelint.json
  5. +156
    -0
      grammars/pp.cson
  6. +16
    -0
      package.json
  7. +6
    -0
      settings/hoa-compiler-plugin.cson
  8. +33
    -0
      styles/hoa-compiler-plugin.less
  9. +96
    -0
      test.pp

+ 3
- 0
.gitignore View File

@@ -0,0 +1,3 @@
.DS_Store
npm-debug.log
node_modules

+ 3
- 0
CHANGELOG.md View File

@@ -0,0 +1,3 @@
## 0.1.0 - First Release
* Every feature added
* Every bug fixed

+ 30
- 0
LICENSE.md View File

@@ -0,0 +1,30 @@
Hoa


New BSD License

Copyright © 2007-2015, Hoa community. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the Hoa nor the names of its contributors may be
used to endorse or promote products derived from this software without
specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.

+ 41
- 0
coffeelint.json View File

@@ -0,0 +1,41 @@
{
"max_line_length": {
"level": "ignore"
},
"no_empty_param_list": {
"level": "error"
},
"arrow_spacing": {
"level": "error"
},
"no_interpolation_in_single_quotes": {
"level": "error"
},
"no_debugger": {
"level": "error"
},
"prefer_english_operator": {
"level": "error"
},
"colon_assignment_spacing": {
"spacing": {
"left": 0,
"right": 1
},
"level": "error"
},
"braces_spacing": {
"spaces": 1,
"level": "error"
},
"spacing_after_comma": {
"level": "error"
},
"no_stand_alone_at": {
"level": "error"
},
"indentation": {
"level": "error",
"value": 4
}
}

+ 156
- 0
grammars/pp.cson View File

@@ -0,0 +1,156 @@
# Hoa
#
#
# New BSD License
#
# Copyright © 2007-2015, Hoa community. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the Hoa nor the names of its contributors may be
# used to endorse or promote products derived from this software without
# specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

'scopeName': 'source.hoa.compiler.pp'
'name': 'Hoa Compiler PP'
'fileTypes': [
'pp'
]
'firstLineMatch': '^%(?:skip|token)\\b'
'foldingStartMarker': '^(?:#?\w+:|//)'
'foldingStopMarker': '^$'
'patterns': [
{ 'include': '#punctuation' }
{ 'include': '#comment' }
{ 'include': '#skip' }
{ 'include': '#token' }
{ 'include': '#node' }
{ 'include': '#rule' }
{ 'include': '#token_capture' }
{ 'include': '#token_nocapture' }
{ 'include': '#rule_call' }
{ 'include': '#node_call' }
]
'repository':
'punctuation':
'captures':
'1':
'name': 'punctuation'
'match': '(\\*|\\+|\\?|\\||->|\\(|\\)|\\{|\\}|\\[|\\])'

'comment':
'captures':
'1':
'name': 'line.comment'
'match': '^(//.*)$'

'skip':
'captures':
'1':
'name': 'skip.line'
'2':
'name': 'skip.keyword'
'3':
'name': 'skip.constant.name'
'4':
'name': 'skip.string.value'
'match': '^((%skip)\\s+([^\\s]+)\\s+([^\\s]+))'

'token':
'captures':
'1':
'name': 'token.line'
'2':
'name': 'keyword'
'3':
'name': 'string.namespace'
'4':
'name': 'punctuation'
'5':
'name': 'constant.name'
'6':
'name': 'string.value'
'7':
'name': 'punctuation'
'8':
'name': 'string.namespace'
'match': '^((%token)\\s+(?:([^\\s]+)(::))?([^\\s]+)\\s+([^\\s]+)\\s+(?:(->)\\s+([^\\s]+))?)'

'node':
'captures':
'1':
'name': 'node.line'
'2':
'name': 'variable.name'
'3':
'name': 'punctuation'
'match': '^((#\\w+)(:))'

'rule':
'captures':
'1':
'name': 'rule.line'
'2':
'name': 'variable.name'
'3':
'name': 'punctuation'
'match': '^((\\w+)(:))'

'token_capture':
'captures':
'1':
'name': 'token.capture'
'2':
'name': 'punctuation'
'3':
'name': 'constant.name'
'4':
'name': 'punctuation'
'match': '((<)([^\\s>]+)(>))'

'token_nocapture':
'captures':
'1':
'name': 'token.nocapture'
'2':
'name': 'punctuation'
'3':
'name': 'constant.name'
'4':
'name': 'punctuation'
'match': '((::)([^\\s:]+)(::))'

'rule_call':
'captures':
'1':
'name': 'rule.call'
'2':
'name': 'variable.name'
'match': '(([^\\s]+)\\(\\))'

'node_call':
'captures':
'1':
'name': 'node.call'
'2':
'name': 'variable.name'
'3':
'name': 'punctuation'
'match': '(((#)\\w+))'

+ 16
- 0
package.json View File

@@ -0,0 +1,16 @@
{
"name": "hoa-compiler-plugin",
"version": "0.0.0",
"description": "Atom tools tools for the PP grammar description language from the PHP Hoa\\Compiler library",
"keywords": ["php", "hoa", "compiler", "pp", "grammar", "language"],
"activationCommands": {
"atom-workspace": "atom-compiler-plugin:toggle"
},
"repository": "https://github.com/hoaproject/Contributions-Atom-Pp.git",
"license": "BSD-3-Clause",
"engines": {
"atom": "*"
},
"dependencies": {
}
}

+ 6
- 0
settings/hoa-compiler-plugin.cson View File

@@ -0,0 +1,6 @@
'.source.hoa.compiler.pp':
'editor':
'autoIndentOnPaste': true
'commentStart': '//'
'foldEndPattern': '^$'
'increaseIndentPattern': '^#?[^\\s]+:$'

+ 33
- 0
styles/hoa-compiler-plugin.less View File

@@ -0,0 +1,33 @@
/**
* Hoa
*
*
* New BSD License
*
* Copyright © 2007-2015, Hoa community. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the Hoa nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

@import "ui-variables";

+ 96
- 0
test.pp View File

@@ -0,0 +1,96 @@
//
// Hoa
//
//
// @license
//
// New BSD License
//
// Copyright © 2007-2015, Ivan Enderlin. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
// * Neither the name of the Hoa nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// Grammar \Hoa\Compiler\Llk.
//
// Provide grammar for the LL(k) parser.
//
// @author Ivan Enderlin <ivan.enderlin@hoa-project.net>
// @copyright Copyright © 2007-2015 Ivan Enderlin.
// @license New BSD License
//


%skip space \s

%token or \|
%token zero_or_one \?
%token one_or_more \+
%token zero_or_more \*
%token n_to_m \{[0-9]+,[0-9]+\}
%token zero_to_m \{,[0-9]+\}
%token n_or_more \{[0-9]+,\}
%token exactly_n \{[0-9]+\}

%token token [a-zA-Z_][a-zA-Z0-9_]*

%token skipped ::
%token kept_ <
%token _kept >
%token named \(\)
%token node #[a-zA-Z][a-zA-Z0-9]+

%token capturing_ \(
%token _capturing \)
%token unification_ \[
%token unification [0-9]+
%token _unification \]

#rule:
choice()

choice:
concatenation() ( ::or:: concatenation() #choice )*

concatenation:
repetition() ( repetition() #concatenation )*

repetition:
simple() ( quantifier() #repetition )? <node>?

simple:
::capturing_:: choice() ::_capturing::
| ::skipped:: <token> ( ::unification_:: <unification> ::_unification:: )?
::skipped:: #skipped
| ::kept_:: <token> ( ::unification_:: <unification> ::_unification:: )?
::_kept:: #kept
| <token> ::named::
( ::unification_:: <unification> ::_unification:: )? #named

quantifier:
<zero_or_one>
| <one_or_more>
| <zero_or_more>
| <n_to_m>
| <n_or_more>
| <exactly_n>

Loading…
Cancel
Save