...
 
Commits (2)
# Default ignored files
/workspace.xml
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.5" project-jdk-type="Python SDK" />
<component name="PyCharmProfessionalAdvertiser">
<option name="shown" value="true" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/msr_aeg.iml" filepath="$PROJECT_DIR$/.idea/msr_aeg.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
This diff is collapsed.
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 2
}
This source diff could not be displayed because it is too large. You can view the blob instead.
import os
reserved = ['scope', 'tree', 'import', 'fragment', 'lexer', 'parser', 'grammar', 'returns',
'locals', 'throws', 'catch', 'finally', 'mode', 'options', 'tokens']
fileExtLst = []
parserRules = []
lexerRules = []
for root, dirs, files in os.walk("../data_scource"):
for file in files:
if file.endswith(".g4"):
fileExtLst.append(os.path.join(root, file))
# print(os.path.join(root, file))
# print(sum(1 for line in open(os.path.join(root, file))))
for filename in fileExtLst:
file = open(filename, 'r')
text = file.readlines()
parsers = 0
lexers = 0
for line in text:
line = line.replace('\n', '')
line = line.replace('\t', '')
line = line.replace(':', '')
# remove reserved keywords
for keyword in reserved:
line = line.replace(keyword, '')
# check if only one word in the line.
# if it starts with a capital, then lexer rule
# parser rules start with a lowercase
numOfWords = line.split(" ")
# remove spaces
while "" in numOfWords:
numOfWords.remove("")
if len(numOfWords) == 1:
if line.islower():
parsers = parsers + 1
else:
lexers = lexers+1
\ No newline at end of file
......@@ -89,7 +89,7 @@ functions : javaIdentifier (DOT functions)*
| NullLiteral
;
// 3.10.1 Integer Literals
// 3.10.1 Integer Literals
IntegerLiteral
: DecimalIntegerLiteral
......@@ -219,7 +219,7 @@ BinaryDigitOrUnderscore
| '_'
;
// 3.10.2 Floating-Point Literals
// 3.10.2 Floating-Point Literals
FloatingPointLiteral
: DecimalFloatingPointLiteral
......@@ -280,14 +280,14 @@ BinaryExponentIndicator
: [pP]
;
// 3.10.3 Boolean Literals
// 3.10.3 Boolean Literals
BooleanLiteral
: 'true'
| 'false'
;
// 3.10.4 Character Literals
// 3.10.4 Character Literals
CharacterLiteral
: '\'' SingleCharacter '\''
......@@ -298,7 +298,7 @@ fragment
SingleCharacter
: ~['\\]
;
// 3.10.5 String Literals
// 3.10.5 String Literals
StringLiteral
: '"' StringCharacters? '"'
;
......@@ -311,7 +311,7 @@ StringCharacter
: ~["\\]
| EscapeSequence
;
// 3.10.6 Escape Sequences for Character and String Literals
// 3.10.6 Escape Sequences for Character and String Literals
fragment
EscapeSequence
: '\\' [btnfr"'\\]
......@@ -336,7 +336,7 @@ ZeroToThree
: [0-3]
;
// 3.10.7 The Null Literal
// 3.10.7 The Null Literal
NullLiteral
: 'null';
......@@ -383,4 +383,4 @@ Identifier
LINE_COMMENT
: '//' ~[\r\n]* -> skip
;
\ No newline at end of file
;
This diff is collapsed.