diff options
| author | admin (centauri.fritz.box) <puppet@mx.buetow.org> | 2014-06-30 23:25:25 +0200 |
|---|---|---|
| committer | admin (centauri.fritz.box) <puppet@mx.buetow.org> | 2014-06-30 23:25:25 +0200 |
| commit | 63cf3028445d8d213ffc774f77aafd7283cb4fbd (patch) | |
| tree | 07eab753ba9ebed866ac13c7b39288589b5b43be /src/core/tools.c | |
| parent | 337c1c8abbe199670259bb043b95b541945427f4 (diff) | |
| parent | a90467d4be3bcf91cab299b4521bf5f762abb1d5 (diff) | |
Merge remote-tracking branch 'remotes/github/build-010388-scheme' into build-010388-schemebuild-010388-scheme
Diffstat (limited to 'src/core/tools.c')
| -rw-r--r-- | src/core/tools.c | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/src/core/tools.c b/src/core/tools.c new file mode 100644 index 0000000..6b6dbab --- /dev/null +++ b/src/core/tools.c @@ -0,0 +1,64 @@ +/*:* + *: File: ./src/core/tools.c + *: A simple Fype interpreter + *: + *: WWW: http://fype.buetow.org + *: AUTHOR: http://paul.buetow.org + *: E-Mail: fype at dev.buetow.org + *: + *: The Fype Language; (c) 2005 - 2010 - Dipl.-Inform. (FH) Paul C. Buetow + *: + *: Redistribution and use in source and binary forms, with or without modi- + *: fication, are permitted provided that the following conditions are met: + *: * Redistributions of source code must retain the above copyright + *: notice, this list of conditions and the following disclaimer. + *: * Redistributions in binary form must reproduce the above copyright + *: notice, this list of conditions and the following disclaimer in the + *: documentation and/or other materials provided with the distribution. + *: * Neither the name of buetow.org nor the names of its contributors may + *: be used to endorse or promote products derived from this software + *: without specific prior written permission. + *: + *: THIS SOFTWARE IS PROVIDED BY PAUL C. BUETOW AS IS'' AND ANY EXPRESS OR + *: IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + *: WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + *: DISCLAIMED. IN NO EVENT SHALL PAUL C. BUETOW BE LIABLE FOR ANY DIRECT, + *: INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + *: (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + *: SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + *: HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + *: STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + *: IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + *: POSSIBILITY OF SUCH DAMAGE. + *:*/ + +#include "tools.h" +#include "token.h" +#include "../defines.h" + +void +tool_skip_block(ListIterator *p_iter, int i_offset) { + Token *p_token = listiterator_current(p_iter); + + do { + if (p_token->tt_cur == TT_PARANT_R && --i_offset == 0) { + //printf("::DoneSkip<%d>: %s\n", i_offset, p_token->c_val); + return; + + } else if (p_token->tt_cur == TT_PARANT_L) { + ++i_offset; + + } else if (i_offset < 0) { + ERROR_INTERPRET("Fatal Error", p_token); + } + + //printf("::Skipping<%d>: %s\n", i_offset, p_token->c_val); + p_token = listiterator_next(p_iter); + } while (listiterator_has_next(p_iter)); + + if (p_token->tt_cur == TT_PARANT_R) + return; + + ERROR_EOB; +} + |
