Version 1.0
Copyright © 2022 Lowell D. Thomas
Python APG
… an
A
BNF
P
arser
G
enerator
Main Page
Related Pages
Packages
Packages
Package Functions
All
a
b
c
d
e
f
g
h
i
k
l
m
n
p
r
s
t
u
v
x
Functions
a
b
c
d
e
f
g
h
i
k
l
m
n
p
r
s
t
u
v
x
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
p
r
s
t
u
v
Classes
Class List
Class Index
Class Members
All
_
a
b
c
d
e
f
g
h
i
l
m
n
o
p
r
s
t
u
w
Functions
_
a
c
d
e
f
g
h
i
o
p
r
s
t
u
w
Variables
a
b
c
e
f
g
h
i
l
m
n
o
p
r
s
t
u
Files
File List
•
All
Classes
Namespaces
Files
Functions
Variables
Pages
examples
ini_file
parser_callbacks.py
Go to the documentation of this file.
1
''' @file examples/ini_file/parser_callbacks.py
2
@brief The parser call back functions for the ini file class.
3
'''
4
import
sys
5
import
os
6
# add the current working directory to the path
7
# DO NOT MOVE THE FOLLOWING STATEMENT
8
# if using autopep8 formatter, for example, set argument '--ignore=E402'
9
sys.path.append(os.getcwd())
10
from
apg_py.lib
import
identifiers
as
id
11
12
13
def
line_end
(cb):
14
if(cb[
'state'
] == id.MATCH):
15
cb[
'user_data'
][
'line_no'
] += 1
16
17
18
def
bad_section_line
(cb):
19
if(cb[
'state'
] == id.MATCH):
20
cb[
'user_data'
][
'errors'
].append({
'line'
: cb[
'user_data'
][
'line_no'
],
21
'message'
:
'bad section definition'
})
22
23
24
def
bad_value_line
(cb):
25
if(cb[
'state'
] == id.MATCH):
26
cb[
'user_data'
][
'errors'
].append({
'line'
: cb[
'user_data'
][
'line_no'
],
27
'message'
:
'bad key/value definition'
})
28
29
30
def
bad_blank_line
(cb):
31
if(cb[
'state'
] == id.MATCH):
32
msg =
'invalid blank line, only white space and comments allowed'
33
cb[
'user_data'
][
'errors'
].append({
'line'
: cb[
'user_data'
][
'line_no'
],
34
'message'
: msg})
apg_py.lib
Definition:
__init__.py:1
examples.ini_file.parser_callbacks.bad_section_line
def bad_section_line(cb)
Definition:
parser_callbacks.py:18
examples.ini_file.parser_callbacks.line_end
def line_end(cb)
Definition:
parser_callbacks.py:13
examples.ini_file.parser_callbacks.bad_value_line
def bad_value_line(cb)
Definition:
parser_callbacks.py:24
examples.ini_file.parser_callbacks.bad_blank_line
def bad_blank_line(cb)
Definition:
parser_callbacks.py:30
Generated by
1.9.1
Python APG, Version 1.0, is licensed under the
2-Clause BSD License
,
an
Open Source Initiative
Approved License.