dragonfly-grammars/_hello_world_aenea.py

37 lines
1.1 KiB
Python

# This file is part of Aenea
#
# Aenea is free software: you can redistribute it and/or modify it under
# the terms of version 3 of the GNU Lesser General Public License as
# published by the Free Software Foundation.
#
# Aenea is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
# License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with Aenea. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright (2014) Alex Roper
# Alex Roper <alex@aroper.net>
from aenea import Grammar, MappingRule, Text
grammar = Grammar('hello world aenea')
print 'Aenea hello world grammar: Loaded.'
class TestRule(MappingRule):
mapping = {
'test hello world remote grammar': Text('Aenea remote setup operational'),
}
grammar.add_rule(TestRule())
grammar.load()
def unload():
global grammar
if grammar:
grammar.unload()
grammar = None