Skip to content

Commit

Permalink
Added Grammar Files property to webpage
Browse files Browse the repository at this point in the history
Also populate `grammar_file` attribute for many languages.
shakeelsamsu authored and jayvdb committed Nov 3, 2018
1 parent e7d3bc0 commit ccc5c78
Showing 10 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions data/Language/CPlusPlus.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
identifier: CPlusPlus
full_name: C++
wikidata: Q2407
grammar_file: https://github.com/antlr/grammars-v4/tree/master/cpp/CPP14.g4
aliases:
- C Plus Plus
- CPP
1 change: 1 addition & 0 deletions data/Language/Golang.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
identifier: Go
wikidata: Q37227
grammar_file: https://github.com/antlr/grammars-v4/blob/master/golang/Golang.g4
aliases:
- golang
extensions:
1 change: 1 addition & 0 deletions data/Language/JSON.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
identifier: JSON
wikidata: Q2063
full_name: JavaScript Object Notation
grammar_file: https://github.com/antlr/grammars-v4/tree/master/json/JSON.g4
extensions:
- json
aliases:
1 change: 1 addition & 0 deletions data/Language/JavaScript.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
identifier: JavaScript
wikidata: Q2005
grammar_file: https://github.com/antlr/grammars-v4/tree/master/javascript/JavaScriptParser.g4
aliases:
- js
- ecmascript
1 change: 1 addition & 0 deletions data/Language/PHP.yaml
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@ identifier: PHP
full_name: PHP
creation_date: 1995
wikidata: Q59
grammar_file: https://github.com/antlr/grammars-v4/tree/master/php/PhpParser.g4
aliases:
- PHP
extensions:
1 change: 1 addition & 0 deletions data/Language/Python.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
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
aliases:
- py
extensions:
1 change: 1 addition & 0 deletions data/Language/TinyBasic.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
identifier: TinyBasic
full_name: TinyBasic
wikidata: Q586622
grammar_file: https://github.com/antlr/grammars-v4/tree/master/tinybasic/tinybasic.g4
aliases:
- TB
extensions:
1 change: 1 addition & 0 deletions data/Language/XML.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
identifier: XML
wikidata: Q2115
full_name: Extensible Markup Language
grammar_file: https://github.com/antlr/grammars-v4/tree/master/xml/XMLParser.g4
extensions:
- xml
delimiters:
14 changes: 14 additions & 0 deletions templates/Language.html.jinja2
Original file line number Diff line number Diff line change
@@ -11,6 +11,14 @@
<h1>{{ m.language_name(language) }}</h1>
</section>
<table>
<tr>
<th>Grammar File</th>
<td>
<a href = {{language.grammar_file}}>
{{ m.show_grammar(language.grammar_file) }}
</a>
</td>
</tr>
<tr>
<th>Aliases</th>
<td>
@@ -41,6 +49,12 @@
{{ m.show_delimiter_list(language.delimiters, delimiter_type_block) }}
</td>
</tr>
<tr>
<th>Datatypes</th>
<td>
{{ m.show_list(language.datatypes) }}
</td>
</tr>
<tr>
<th>Keywords</th>
<td>
4 changes: 4 additions & 0 deletions templates/macros.jinja2
Original file line number Diff line number Diff line change
@@ -6,6 +6,10 @@
{% endif %}
{% endmacro %}

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

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

0 comments on commit ccc5c78

Please sign in to comment.