Skip to content

Commit d1813ab

Browse files
committedJun 6, 2020
guitar tab
1 parent 95f7f50 commit d1813ab

9 files changed

+226
-0
lines changed
 

‎guitartab/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Guitar Tab Grammar
2+
3+
An ANTLR4 grammar for guitar tablature

‎guitartab/examples/example1.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
e ---|---|---|---|---|
2+
B -x-|---|---|---|---|
3+
G ---|-x-|---|---|---|
4+
D ---|-x-|---|---|---|
5+
A ---|---|---|---|---|
6+
E ---|---|---|---|---|

‎guitartab/examples/example2.txt

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
e ---|---|---|---|---|
2+
B -x-|---|---|---|---|
3+
G ---|---|---|---|---|
4+
D ---|-x-|---|---|---|
5+
A ---|---|-x-|---|---|
6+
E ---|---|-o-|---|---|
7+

‎guitartab/examples/example3.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
e ---|---|---|---|---|
2+
B ---|---|---|---|---|
3+
G ---|---|---|---|---|
4+
D ---|-x-|---|---|---|
5+
A ---|-x-|---|---|---|
6+
E ---|---|---|---|---|

‎guitartab/examples/example4.txt

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
e -x-|---|---|---|---|
2+
B -x-|---|---|---|---|
3+
G ---|-x-|---|---|---|
4+
D ---|---|-x-|---|---|
5+
A ---|---|-x-|---|---|
6+
E -x-|---|---|---|---|
7+

‎guitartab/examples/example5.txt

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
e ---|---|-x-|---|---|
2+
B ---|---|---|---|---|
3+
G ---|---|---|---|---|
4+
D ---|---|---|---|---|
5+
A ---|-x-|---|---|---|
6+
E ---|---|-x-|---|---|

‎guitartab/guitartab.g4

+135
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
/*
2+
BSD License
3+
4+
Copyright (c) 2020, Tom Everett
5+
All rights reserved.
6+
7+
Redistribution and use in source and binary forms, with or without
8+
modification, are permitted provided that the following conditions
9+
are met:
10+
11+
1. Redistributions of source code must retain the above copyright
12+
notice, this list of conditions and the following disclaimer.
13+
2. Redistributions in binary form must reproduce the above copyright
14+
notice, this list of conditions and the following disclaimer in the
15+
documentation and/or other materials provided with the distribution.
16+
3. Neither the name of Tom Everett nor the names of its contributors
17+
may be used to endorse or promote products derived from this software
18+
without specific prior written permission.
19+
20+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24+
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31+
*/
32+
grammar guitartab;
33+
34+
tab
35+
: string+
36+
;
37+
38+
string
39+
: note (position FRET)+
40+
;
41+
42+
position
43+
: (FINGER | BARLNE)+
44+
;
45+
46+
note
47+
: BA
48+
| BB
49+
| BC
50+
| BD
51+
| BE
52+
| BF
53+
| BG
54+
| LA
55+
| LB
56+
| LC
57+
| LD
58+
| LE
59+
| LF
60+
| LG
61+
;
62+
63+
BA
64+
: 'A'
65+
;
66+
67+
BB
68+
: 'B'
69+
;
70+
71+
BC
72+
: 'C'
73+
;
74+
75+
BD
76+
: 'D'
77+
;
78+
79+
BE
80+
: 'E'
81+
;
82+
83+
BF
84+
: 'F'
85+
;
86+
87+
BG
88+
: 'G'
89+
;
90+
91+
LA
92+
: 'a'
93+
;
94+
95+
LB
96+
: 'b'
97+
;
98+
99+
LC
100+
: 'c'
101+
;
102+
103+
LD
104+
: 'd'
105+
;
106+
107+
LE
108+
: 'e'
109+
;
110+
111+
LF
112+
: 'f'
113+
;
114+
115+
LG
116+
: 'g'
117+
;
118+
119+
FINGER
120+
: 'x'
121+
| 'o'
122+
;
123+
124+
BARLNE
125+
: '-'
126+
;
127+
128+
FRET
129+
: '|'
130+
;
131+
132+
WHITESPACE
133+
: (' ' | '\t' | '\n')+ -> skip
134+
;
135+

‎guitartab/pom.xml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<artifactId>guitartab</artifactId>
5+
<packaging>jar</packaging>
6+
<name>khubla.com Guirar Tab grammar</name>
7+
<parent>
8+
<groupId>org.antlr.grammars</groupId>
9+
<artifactId>grammarsv4</artifactId>
10+
<version>1.0-SNAPSHOT</version>
11+
<relativePath>../pom.xml</relativePath>
12+
</parent>
13+
<build>
14+
<plugins>
15+
<plugin>
16+
<groupId>org.antlr</groupId>
17+
<artifactId>antlr4-maven-plugin</artifactId>
18+
<version>${antlr.version}</version>
19+
<configuration>
20+
<sourceDirectory>${basedir}</sourceDirectory>
21+
<grammars>guitartab.g4</grammars>
22+
<visitor>true</visitor>
23+
<listener>true</listener>
24+
</configuration>
25+
<executions>
26+
<execution>
27+
<goals>
28+
<goal>antlr4</goal>
29+
</goals>
30+
</execution>
31+
</executions>
32+
</plugin>
33+
<plugin>
34+
<groupId>com.khubla.antlr</groupId>
35+
<artifactId>antlr4test-maven-plugin</artifactId>
36+
<version>${antlr4test-maven-plugin.version}</version>
37+
<configuration>
38+
<verbose>false</verbose>
39+
<showTree>false</showTree>
40+
<entryPoint>tab</entryPoint>
41+
<grammarName>guitartab</grammarName>
42+
<packageName></packageName>
43+
<exampleFiles>examples/</exampleFiles>
44+
</configuration>
45+
<executions>
46+
<execution>
47+
<goals>
48+
<goal>test</goal>
49+
</goals>
50+
</execution>
51+
</executions>
52+
</plugin>
53+
</plugins>
54+
</build>
55+
</project>

‎pom.xml

+1
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@
119119
<module>graphstream-dgs</module>
120120
<module>gtin</module>
121121
<module>guido</module>
122+
<module>guitartab</module>
122123
<module>html</module>
123124
<module>http</module>
124125
<module>hypertalk</module>

0 commit comments

Comments
 (0)