Back to index

texmacs  1.0.7.15
tree_analyze.hpp
Go to the documentation of this file.
00001 
00002 /******************************************************************************
00003 * MODULE     : tree_analyze.hpp
00004 * DESCRIPTION: routines for analyzing trees
00005 * COPYRIGHT  : (C) 2010  Joris van der Hoeven
00006 *******************************************************************************
00007 * This software falls under the GNU general public license version 3 or later.
00008 * It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
00009 * in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
00010 ******************************************************************************/
00011 
00012 #ifndef TREE_ANALYZE_H
00013 #define TREE_ANALYZE_H
00014 #include "drd_std.hpp"
00015 #include "language.hpp"
00016 #include "analyze.hpp"
00017 #include "vars.hpp"
00018 
00019 /******************************************************************************
00020 * Concatenations and with-like structures
00021 ******************************************************************************/
00022 
00023 array<tree> concat_tokenize (tree t);
00024 array<tree> concat_decompose (tree t);
00025 tree concat_recompose (array<tree> a);
00026 
00027 bool is_with_like (tree t);
00028 tree& with_body (tree w);
00029 bool with_same_type (tree w1, tree w2);
00030 bool with_similar_type (tree w1, tree w2);
00031 array<tree> with_decompose (tree w, tree t);
00032 tree with_recompose (tree w, array<tree> a);
00033 
00034 /******************************************************************************
00035 * Symbol types
00036 ******************************************************************************/
00037 
00038 #define SYMBOL_DELETED           -1
00039 #define SYMBOL_BASIC              0
00040 #define SYMBOL_PREFIX             1
00041 #define SYMBOL_POSTFIX            2
00042 #define SYMBOL_INFIX              3
00043 #define SYMBOL_SEPARATOR          4
00044 #define SYMBOL_SKIP               5
00045 #define SYMBOL_SCRIPT             6
00046 #define SYMBOL_OPEN_BIG           7
00047 #define SYMBOL_CLOSE_BIG          8
00048 #define SYMBOL_OPEN               9
00049 #define SYMBOL_MIDDLE            10
00050 #define SYMBOL_CLOSE             11
00051 #define SYMBOL_PROBABLE_OPEN     12
00052 #define SYMBOL_PROBABLE_MIDDLE   13
00053 #define SYMBOL_PROBABLE_CLOSE    14
00054 #define SYMBOL_DUBIOUS_OPEN      15
00055 #define SYMBOL_DUBIOUS_MIDDLE    16
00056 #define SYMBOL_DUBIOUS_CLOSE     17
00057 
00058 int symbol_type (tree t);
00059 array<int> symbol_types (array<tree> a);
00060 
00061 /******************************************************************************
00062 * Symbol priorities
00063 ******************************************************************************/
00064 
00065 #define PRIORITY_SEPARATOR          0
00066 #define PRIORITY_ASSIGN             1
00067 #define PRIORITY_FLUX               2
00068 #define PRIORITY_MODELS             3
00069 #define PRIORITY_IMPLY              4
00070 #define PRIORITY_OR                 5
00071 #define PRIORITY_AND                6
00072 #define PRIORITY_RELATION           7
00073 #define PRIORITY_ARROW              8
00074 #define PRIORITY_UNION              9
00075 #define PRIORITY_INTERSECTION      10
00076 #define PRIORITY_PLUS              11
00077 #define PRIORITY_TIMES             12
00078 #define PRIORITY_POWER             13
00079 #define PRIORITY_RADICAL           14
00080 
00081 int symbol_priority (tree t);
00082 array<int> symbol_priorities (array<tree> a);
00083 
00084 /******************************************************************************
00085 * DRD-based
00086 ******************************************************************************/
00087 
00088 drd_info get_document_drd (tree doc);
00089 bool is_correctable_child (tree t, int i, bool noaround= false);
00090 
00091 #endif // defined TREE_ANALYZE_H