Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
dumux
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dumux-repositories
dumux
Commits
ae955275
Commit
ae955275
authored
5 years ago
by
Dennis Gläser
Browse files
Options
Downloads
Patches
Plain Diff
[docgen][code_to_md] rename parse action variables
parent
73cead2d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!1915
Feature/modify python examples docgen
,
!1914
[examples] Implement Python-only doc generator using pyparsing
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/convert_code_to_doc.py
+10
-10
10 additions, 10 deletions
examples/convert_code_to_doc.py
with
10 additions
and
10 deletions
examples/convert_code_to_doc.py
+
10
−
10
View file @
ae955275
...
...
@@ -34,21 +34,21 @@ def cppRules():
"""
Define a list of rules to apply for cpp source code
"""
h
eader
=
Suppress
(
Combine
(
"
// -*-
"
+
SkipTo
(
"
*******/
"
+
LineEnd
())
+
"
*******/
"
))
h
eaderGuard
=
Suppress
(
"
#ifndef
"
+
Optional
(
restOfLine
)
+
LineEnd
()
+
"
#define
"
+
Optional
(
restOfLine
))
e
ndHeaderGuard
=
Suppress
(
"
#endif
"
+
Optional
(
restOfLine
))
suppressH
eader
=
Suppress
(
Combine
(
"
// -*-
"
+
SkipTo
(
"
*******/
"
+
LineEnd
())
+
"
*******/
"
))
suppressH
eaderGuard
=
Suppress
(
"
#ifndef
"
+
Optional
(
restOfLine
)
+
LineEnd
()
+
"
#define
"
+
Optional
(
restOfLine
))
suppressE
ndHeaderGuard
=
Suppress
(
"
#endif
"
+
Optional
(
restOfLine
))
# make a code block (possibly containing comments) between [[codeblock]] and [[/codeblock]]
action
=
createMarkdownCode
(
"
cpp
"
)
c
odeblock
=
parseTaggedContent
(
"
codeblock
"
,
action
=
action
)
createCppBlock
=
createMarkdownCode
(
"
cpp
"
)
parseC
odeblock
=
parseTaggedContent
(
"
codeblock
"
,
action
=
createCppBlock
)
# treat doc and code line
d
oc
=
LineStart
()
+
Suppress
(
ZeroOrMore
(
"
"
)
+
"
//
"
+
ZeroOrMore
(
"
"
))
+
Optional
(
restOfLine
)
c
ode
=
LineStart
()
+
~
(
ZeroOrMore
(
"
"
)
+
"
//
"
)
+
(
SkipTo
(
d
oc
)
|
SkipTo
(
StringEnd
()))
c
ode
.
setParseAction
(
action
)
docTransforms
=
c
odeblock
|
doc
|
c
ode
parseD
oc
=
LineStart
()
+
Suppress
(
ZeroOrMore
(
"
"
)
+
"
//
"
+
ZeroOrMore
(
"
"
))
+
Optional
(
restOfLine
)
parseC
ode
=
LineStart
()
+
~
(
ZeroOrMore
(
"
"
)
+
"
//
"
)
+
(
SkipTo
(
parseD
oc
)
|
SkipTo
(
StringEnd
()))
parseC
ode
.
setParseAction
(
createCppBlock
)
docTransforms
=
parseC
odeblock
|
parseDoc
|
parseC
ode
return
[
header
,
h
eaderGuard
,
e
ndHeaderGuard
,
docTransforms
]
return
[
suppressHeader
,
suppressH
eaderGuard
,
suppressE
ndHeaderGuard
,
docTransforms
]
def
transformCode
(
code
,
rules
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment