Skip to content

Commit

Permalink
Issue #94 and progress on Issue #91 (#101)
Browse files Browse the repository at this point in the history
* Issue #94 and progress on Issue #91

Major refactor of language context to drive filter options from
configuration. The ability to modify things like stropping and
encoding were fundamentally broken before this change.

This work was done in support of adding named types as a concept to
languages. This will allow generation of serialization code that is more
configurable and will avoid fixing decisions like the use of size_t into
templates instead moving these decisions into user-overridable
configuration.

* updates per PR review comments
  • Loading branch information
thirtytwobits authored Dec 13, 2019
1 parent 87daa4c commit 42eb7cd
Show file tree
Hide file tree
Showing 38 changed files with 1,450 additions and 788 deletions.
3 changes: 2 additions & 1 deletion .vscode/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@

**/nunavut_out/*
**/nunavut_out/*
**/compile_commands.json
45 changes: 45 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"configurations": [
{
"name": "Mac",
"intelliSenseMode": "clang-x64",
"includePath": [
"${workspaceFolder}/submodules/googletest/googlemock/include",
"${workspaceFolder}/verification/cpp/build/generated",
"${workspaceFolder}/verification/cpp/include"
],
"browse": {
"path": [
"${workspaceFolder}/verification/cpp/test"
],
"limitSymbolsToIncludedHeaders": false
},
"macFrameworkPath": [
"/System/Library/Frameworks",
"/Library/Frameworks"
],
"compileCommands": "${workspaceFolder}/.vscode/compile_commands.json",
"configurationProvider": "ms-vscode.cmake-tools",
"cStandard": "c11",
"cppStandard": "c++11"
},
{
"name": "Linux",
"intelliSenseMode": "gcc-x64",
"includePath": [
"${workspaceFolder}/submodules/googletest/googlemock/include",
"${workspaceFolder}/verification/cpp/build/generated",
"${workspaceFolder}/verification/cpp/include"
],
"browse": {
"path": [
"${workspaceFolder}/verification/cpp/test"
],
"limitSymbolsToIncludedHeaders": false
},
"compileCommands": "${workspaceFolder}/.vscode/compile_commands.json",
"configurationProvider": "ms-vscode.cmake-tools"
}
],
"version": 4
}
16 changes: 16 additions & 0 deletions .vscode/cmake-kits.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[
{
"name": "native-gcc",
"toolchainFile": "${workspaceFolder}/verification/cpp/cmake/toolchains/gcc-native.cmake",
"cmakeSettings": {
"NUNAVUT_FLAG_SET": "../cmake/compiler_flag_sets/native.cmake"
}
},
{
"name": "native-clang",
"toolchainFile": "${workspaceFolder}/verification/cpp/cmake/toolchains/clang-native.cmake",
"cmakeSettings": {
"NUNAVUT_FLAG_SET": "../cmake/compiler_flag_sets/native.cmake"
}
}
]
2 changes: 1 addition & 1 deletion .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"lextudio.restructuredtext",
"ms-vscode.cpptools",
"twxs.cmake",
"vector-of-bool.cmake-tools",
"ms-vscode.cmake-tools",
"xaver.clang-format"
]
}
8 changes: 8 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,13 @@
"console": "internalConsole",
"cwd": "${workspaceFolder}/test"
},
{
"name": "Pytest: all doctests",
"type": "python",
"request": "launch",
"module": "pytest",
"console": "internalConsole",
"cwd": "${workspaceFolder}/src"
},
]
}
113 changes: 108 additions & 5 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
"python.linting.mypyEnabled": true,
"python.linting.pycodestyleEnabled": true,
"python.linting.enabled": true,
"python.linting.pycodestyleArgs": ["--ignore", "E501,E251,E701"],
"python.linting.pycodestyleArgs": [
"--ignore",
"E501,E251,E701"
],
"python.testing.cwd": "${workspaceFolder}",
"python.testing.unittestEnabled": false,
"python.testing.nosetestsEnabled": false,
Expand All @@ -22,8 +25,8 @@
"**/CVS": true,
"**/.DS_Store": true,
"**/.coverage.*": true,
"**/__pycache__" : true,
"**/.pytest_cache" : true,
"**/__pycache__": true,
"**/.pytest_cache": true,
"**/*.egg-info": true
},
"cSpell.words": [
Expand Down Expand Up @@ -61,6 +64,7 @@
"isroutine",
"itertools",
"kwlist",
"lctx",
"macrofy",
"managedsecretsbucket",
"markupsafe",
Expand All @@ -81,6 +85,7 @@
"pyyaml",
"rcfile",
"reflexpr",
"rtype",
"scotec",
"serializable",
"sonarcloud",
Expand All @@ -92,5 +97,103 @@
"xargs",
"yamlfy"
],
"cmake.configureOnOpen": false
}
"cmake.configureOnOpen": false,
"cmake.buildDirectory": "${workspaceFolder}/verification/cpp/build",
"cmake.sourceDirectory": "${workspaceFolder}/verification/cpp",
"cmake.buildBeforeRun": true,
"cmake.copyCompileCommands": "${workspaceFolder}/.vscode/compile_commands.json",
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools",
"C_Cpp.configurationWarnings": "Disabled",
"files.associations": {
"__bit_reference": "cpp",
"__config": "cpp",
"__debug": "cpp",
"__errc": "cpp",
"__functional_base": "cpp",
"__hash_table": "cpp",
"__locale": "cpp",
"__mutex_base": "cpp",
"__node_handle": "cpp",
"__nullptr": "cpp",
"__split_buffer": "cpp",
"__string": "cpp",
"__threading_support": "cpp",
"__tree": "cpp",
"__tuple": "cpp",
"algorithm": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"cfenv": "cpp",
"chrono": "cpp",
"cinttypes": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"codecvt": "cpp",
"complex": "cpp",
"condition_variable": "cpp",
"csetjmp": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"exception": "cpp",
"forward_list": "cpp",
"fstream": "cpp",
"functional": "cpp",
"future": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"iterator": "cpp",
"limits": "cpp",
"list": "cpp",
"locale": "cpp",
"map": "cpp",
"memory": "cpp",
"mutex": "cpp",
"new": "cpp",
"numeric": "cpp",
"optional": "cpp",
"ostream": "cpp",
"queue": "cpp",
"random": "cpp",
"ratio": "cpp",
"regex": "cpp",
"scoped_allocator": "cpp",
"set": "cpp",
"shared_mutex": "cpp",
"sstream": "cpp",
"stack": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"string": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"thread": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"utility": "cpp",
"valarray": "cpp",
"vector": "cpp"
},
"python.linting.mypyArgs": [
"--config-file=${workspaceFolder}/tox.ini"
]
}
9 changes: 3 additions & 6 deletions CONTRIBUTING.rst
Original file line number Diff line number Diff line change
Expand Up @@ -175,15 +175,12 @@ Of course, you can just use `Visual Studio Code`_ to build and preview the docs
apidoc
================================================

We manually generate the api doc using ``sphinx-apidoc``. To regenerate do the following ::
We manually generate the api doc using ``sphinx-apidoc``. To regenerate use ``tox -e gen-apidoc``.

sphinx-apidoc --doc-project library -E -o docs/api src "**/conftest.py" "src/nunavut/jinja/jinja2/**" "src/nunavut/jinja/markupsafe/**"

.. note::
.. warning::

If you've changed things a lot you might need to remove the api directory first.
``tox -e gen-apidoc`` will start by deleting the docs/api directory.

This will create a new change you will need to submit in a PR.

************************************************
Coverage and Linting Reports
Expand Down
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Partial example: generating a C struct
{
{%- for attribute in T.attributes %}
{%- if attribute is constant %}
const {{ attribute.data_type | c.type_from_primitive(use_standard_types=True) }} {{ attribute.name }} = {{ attribute.value }};
const {{ attribute.data_type | c.type_from_primitive }} {{ attribute.name }} = {{ attribute.value }};
{% endif -%}
{% endfor %}
Expand Down
17 changes: 17 additions & 0 deletions docs/api/nunavut.lang.cpp.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
nunavut.lang.cpp package
========================

Subpackages
-----------

.. toctree::

nunavut.lang.cpp.templates

Module contents
---------------

.. automodule:: nunavut.lang.cpp
:members:
:undoc-members:
:show-inheritance:
10 changes: 10 additions & 0 deletions docs/api/nunavut.lang.cpp.templates.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
nunavut.lang.cpp.templates package
==================================

Module contents
---------------

.. automodule:: nunavut.lang.cpp.templates
:members:
:undoc-members:
:show-inheritance:
13 changes: 7 additions & 6 deletions docs/api/nunavut.lang.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
nunavut.lang package
====================

Subpackages
-----------

.. toctree::

nunavut.lang.cpp

Submodules
----------

Expand All @@ -11,12 +18,6 @@ Submodules
:show-inheritance:


.. automodule:: nunavut.lang.cpp
:members:
:undoc-members:
:show-inheritance:


.. automodule:: nunavut.lang.js
:members:
:undoc-members:
Expand Down
6 changes: 6 additions & 0 deletions docs/api/nunavut.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ Submodules
:show-inheritance:


.. automodule:: nunavut.templates
:members:
:undoc-members:
:show-inheritance:


.. automodule:: nunavut.version
:members:
:undoc-members:
Expand Down
5 changes: 5 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file provided for readthedocs.io only. Use tox.ini for all dependencies.

sphinx >= 1.8.5
sphinx-argparse
sphinx_rtd_theme
Loading

0 comments on commit 42eb7cd

Please sign in to comment.