Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.coafile: Check yaml files and the templates #39

Merged
merged 1 commit into from
Nov 7, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .coafile
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[jinja2]
bears = Jinja2Bear
files = **.jinja2

[yaml]
bears = YAMLLintBear
files = *.yml, **.yaml
159 changes: 80 additions & 79 deletions data/Language/CSharp.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
identifier: CSharp
full_name: C#
wikidata: Q2370
grammar_file: https://github.com/antlr/grammars-v4/tree/master/csharp/CSharpParser.g4
grammar_file: https://github.com/antlr/grammars-v4/tree/master/csharp/
CSharpParser.g4
aliases:
jayvdb marked this conversation as resolved.
Show resolved Hide resolved
- C Sharp
- CS
@@ -18,81 +19,81 @@ delimiters:
- verbatim
- curly_braces
keywords:
- abstract
- as
- base
- bool
- break
- byte
- case
- catch
- char
- checked
- class
- const
- continue
- decimal
- default
- delegate
- do
- double
- else
- enum
- event
- explicit
- extern
- false
- finally
- fixed
- float
- for
- foreach
- goto
- if
- implicit
- in
- int
- interface
- internal
- is
- lock
- long
- namespace
- new
- 'null'
- object
- operator
- out
- override
- params
- private
- protected
- public
- readonly
- ref
- return
- sbyte
- sealed
- short
- sizeof
- stackalloc
- static
- string
- struct
- switch
- this
- throw
- true
- try
- typeof
- uint
- ulong
- unchecked
- unsafe
- ushort
- using
- using static
- virtual
- void
- volatile
- while
- abstract
- as
- base
- bool
- break
- byte
- case
- catch
- char
- checked
- class
- const
- continue
- decimal
- default
- delegate
- do
- double
- else
- enum
- event
- explicit
- extern
- false
- finally
- fixed
- float
- for
- foreach
- goto
- if
- implicit
- in
- int
- interface
- internal
- is
- lock
- long
- namespace
- new
- 'null'
- object
- operator
- out
- override
- params
- private
- protected
- public
- readonly
- ref
- return
- sbyte
- sealed
- short
- sizeof
- stackalloc
- static
- string
- struct
- switch
- this
- throw
- true
- try
- typeof
- uint
- ulong
- unchecked
- unsafe
- ushort
- using
- using static
- virtual
- void
- volatile
- while
2 changes: 1 addition & 1 deletion data/Language/JSON.yaml
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@ identifier: JSON
wikidata: Q2063
full_name: JavaScript Object Notation
grammar_file: https://github.com/antlr/grammars-v4/tree/master/json/JSON.g4
extensions:
extensions:
- json
aliases:
- json
4 changes: 2 additions & 2 deletions data/Language/Java.yaml
Original file line number Diff line number Diff line change
@@ -5,14 +5,14 @@ full_name: Java
grammar_file: https://github.com/antlr/grammars-v4/blob/master/java8/Java8.g4
aliases:
- java
extensions:
extensions:
- java
delimiters:
# comment delimters:
- double_slash
- multiline_slash_star
# string delimiters:
- double_quote_slash_escape
- double_quote_slash_escape
datatypes:
- boolean_java
- byte_java
3 changes: 2 additions & 1 deletion data/Language/JavaScript.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
identifier: JavaScript
wikidata: Q2005
grammar_file: https://github.com/antlr/grammars-v4/tree/master/javascript/JavaScriptParser.g4
grammar_file: https://github.com/antlr/grammars-v4/tree/master/javascript/
JavaScriptParser.g4
aliases:
jayvdb marked this conversation as resolved.
Show resolved Hide resolved
- js
- ecmascript
3 changes: 2 additions & 1 deletion data/Language/Python.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
identifier: Python
wikidata: Q28865
versions: 2.7, 3.3, 3.4, 3.5, 3.6
grammar_file: https://github.com/antlr/grammars-v4/tree/master/python3/Python3.g4
grammar_file: https://github.com/antlr/grammars-v4/tree/master/python3/
Python3.g4
aliases:
jayvdb marked this conversation as resolved.
Show resolved Hide resolved
- py
extensions:
3 changes: 2 additions & 1 deletion data/Language/TinyBasic.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
identifier: TinyBasic
full_name: TinyBasic
wikidata: Q586622
grammar_file: https://github.com/antlr/grammars-v4/tree/master/tinybasic/tinybasic.g4
grammar_file: https://github.com/antlr/grammars-v4/tree/master/tinybasic/
tinybasic.g4
aliases:
jayvdb marked this conversation as resolved.
Show resolved Hide resolved
- TB
extensions:
4 changes: 2 additions & 2 deletions models/DataType.yaml
Original file line number Diff line number Diff line change
@@ -3,5 +3,5 @@ keyword: String # Keyword that identifies the type i.e. int, str
integer-min: String # String representing minium integer or uncertain
integer-max: String # String represetinng maximum integer or uncertain
integer-signed: Boolean # Whether the datatype is signed integer or not
delimiters: Delimiter[] # If the datatype has any delimiters
literals: Keyword[] # List of literals for a datatype
delimiters: Delimiter[] # If the datatype has any delimiters
literals: Keyword[] # List of literals for a datatype
2 changes: 1 addition & 1 deletion templates/Language.html.jinja2
Original file line number Diff line number Diff line change
@@ -14,7 +14,7 @@
<tr>
<th>Grammar File</th>
<td>
<a href = {{language.grammar_file}}>
<a href = {{ language.grammar_file }}>
{{ m.show_grammar(language.grammar_file) }}
</a>
</td>
2 changes: 1 addition & 1 deletion templates/home.html.jinja2
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@
<ul class="thin-row-medium" id="languages-list">
{% for language in languages %}
<li><a href="{% url 'languages', language %}">{{ m.language_name(language) }}</a>
{% endfor %}
{% endfor %}{# for language in languages #}
</ul>
</body>
</html>
14 changes: 7 additions & 7 deletions templates/macros.jinja2
Original file line number Diff line number Diff line change
@@ -3,17 +3,17 @@
{{ language.full_name }}
{% else %}
{{ language.identifier }}
{% endif %}
{% endif %}{# if language.full_name #}
{% endmacro %}

{% macro show_grammar(grammar_file) %}
{{grammar_file}}
{{ grammar_file }}
{% endmacro %}

{% macro show_list(list, separator=',') %}
{% for item in list %}
{{ item.pk | escape }}{% if not loop.last %}{{separator}} {% endif %}
{% endfor %}
{{ item.pk | escape }}{% if not loop.last %}{{ separator }} {% endif %}
{% endfor %}{# for item in list #}
{% endmacro %}

{% macro show_delimiter_list(delimiters, type) %}
@@ -25,9 +25,9 @@
<tt>{{ item.end | escape }}</tt>
{% else %}
(EOL)
{% endif %}
{% endif %}{# if item.end #}
</li>
{% endif %}
{% endfor %}
{% endif %}{# if item.type == type #}
{% endfor %}{# for item in delimiters #}
</ul>
{% endmacro %}
9 changes: 6 additions & 3 deletions views/languages.yaml
Original file line number Diff line number Diff line change
@@ -5,6 +5,9 @@ path:
template: Language
context:
dynamic:
delimiter_type_comment: session.query(EnumDelimiterType).filter(EnumDelimiterType.name == 'comment').one()
delimiter_type_string: session.query(EnumDelimiterType).filter(EnumDelimiterType.name == 'string').one()
delimiter_type_block: session.query(EnumDelimiterType).filter(EnumDelimiterType.name == 'block').one()
delimiter_type_comment: session.query(EnumDelimiterType).filter
(EnumDelimiterType.name == 'comment').one()
delimiter_type_string: session.query(EnumDelimiterType).filter
jayvdb marked this conversation as resolved.
Show resolved Hide resolved
(EnumDelimiterType.name == 'string').one()
delimiter_type_block: session.query(EnumDelimiterType).filter
(EnumDelimiterType.name == 'block').one()