Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Finish antlr generator infrastructure
  • Loading branch information
deniskoronchik committed Oct 25, 2021
commit a2948c14d216475787ffee479bb575ebb47c1c51
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,6 @@ dmypy.json
*.ini

.antlr
antlr*.jar
antlr*.jar

*.code-workspace
5 changes: 3 additions & 2 deletions db/sc/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,22 @@
from sc.core.transaction import TransactionWrite, TransactionRead, TransactionNamesWrite, TransactionNamesRead

import neo4j
import logging


class Memory:

def __init__(self, config_path: str):
self._config = Config(config_path)

print(f"Connecting to {self._config.db_uri()}")
logging.info(f"Connecting to {self._config.db_uri()}")
self._client = Client(
self._config.db_uri(),
self._config.db_user(),
self._config.db_password())

def close(self):
print(f"Close connection to {self._config.db_uri()}")
logging.info(f"Close connection to {self._config.db_uri()}")
self._client.close()

@property
Expand Down
1 change: 1 addition & 0 deletions db/sc/scs/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from .parser import SCsParser
2 changes: 2 additions & 0 deletions db/sc/scs/_parser/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .scsLexer import scsLexer as SCsLexerImpl
from .scsParser import scsParser as SCsParserImpl
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated from scs/scs.g4 by ANTLR 4.9.2
# Generated from sc/scs/scs.g4 by ANTLR 4.9.2
from antlr4 import *
from io import StringIO
import sys
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated from scs/scs.g4 by ANTLR 4.9.2
# Generated from sc/scs/scs.g4 by ANTLR 4.9.2
# encoding: utf-8
from antlr4 import *
from io import StringIO
Expand Down
8 changes: 8 additions & 0 deletions db/sc/scs/parser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
from ._parser import SCsLexerImpl, SCsParserImpl
from antlr4 import *


class SCsParser:

def __init__(self) -> None:
pass
File renamed without changes.
7 changes: 6 additions & 1 deletion db/scripts/generate_antlr.sh
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
java -jar $1 -Dlanguage=Python3 -o scs/parser -no-listener -no-visitor -Xexact-output-dir scs/scs.g4
if [ -z "$1" ]
then
echo "Please specify path to antlr tool. For example:\033[1;34m generate_antlr.sh antlr-4.9.2-complete.jar\033[0m"
else
java -jar $1 -Dlanguage=Python3 -o sc/scs/_parser -no-listener -no-visitor -Xexact-output-dir sc/scs/scs.g4
fi
6 changes: 6 additions & 0 deletions db/tests/units/scs/test_scs_parser.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import unittest

class TestSCsParser(unittest.TestCase):

def test_smoke(self):
pass