Skip to content

Commit

Permalink
snippets_in_multiple_languages (#23)
Browse files Browse the repository at this point in the history
* Add const methods to cpp

* Move common snippet for c like languages to c-like.json file and add C ans Java to snippets in c-like.json and cpp.json

* Fix language for snippets in core.json

* Include C to main snippet

* Added C test and refactor Cpp tests

* Change inside_wblock to inside_block in struct

* Add struct in C

* Add C snippet library to docs

* Strait out C/C++ code blocks

* Fix triple { bug

* Add java snippets

* Change compositemethod for cpp to be consistent with java

* Change template in cpp to be consistent with java

* Fix abstract method definition in Java

* Added java stdlib docs

* Change implicit snippet to be block instead of wblock

* Add else

* Add python snippet definitions

* Change inside_wblock with inside_block in most places

* Add python tests and docs
  • Loading branch information
Ahhhhmed committed Apr 28, 2018
1 parent faccea5 commit c6e4498
Show file tree
Hide file tree
Showing 18 changed files with 1,887 additions and 447 deletions.
11 changes: 6 additions & 5 deletions docs/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Hello world

.. code-block:: text
stdinc$stdio.h&[[main]]>printf("Hello, world\!");&return 0;
stdinc$stdio.h& &[[main]]>printf("Hello, world\!");&return 0;
.. code-block:: C
Expand Down Expand Up @@ -212,12 +212,13 @@ This is a fairly large example but includes most of the feathers of Homotopy.
stdinc$stdio.h&[[main]]>printf("Hello, world\!");&return 0;
At the top level there are two snippets:
At the top level there are three snippets:

1. :code:`stdinc$stdio.h` and
2. :code:`[[main]]>printf("Hello, world\!");&return 0;`
2. Space for an empty line.
3. :code:`[[main]]>printf("Hello, world\!");&return 0;`

They are implicitly inside an implicit :code:`block` snippet. Block snippet just separate snippets by an empty line.
They are implicitly inside an implicit :code:`block` snippet. Block snippet just separate snippets lines.

Definitions used to compile this snippet:

Expand All @@ -236,7 +237,7 @@ Definitions used to compile this snippet:
:code:`stdinc` has the definition :code:`#include <$$$>`
and :code:`stdio.h` just gets replaced in to get :code:`#include <stdio.h>`

Lets now go through the second snippet step by step:
Lets now go through the third snippet step by step:

1. :code:`[[main]]` gets expanded into :code:`func#int@main#int$argc#char*$argv[]`.
2. :code:`func` get expanded into :code:`### @@@({{params}}){\n{{inside_wblock}}\n}`.
Expand Down

0 comments on commit c6e4498

Please sign in to comment.