as2js: /home/snapwebsites/snapcpp/contrib/as2js/lib/node_type.cpp Source File

as2js  0.1.14
AlexScript to JavaScript
node_type.cpp
Go to the documentation of this file.
1 /* lib/node_type.cpp
2 
3 Copyright (c) 2005-2019 Made to Order Software Corp. All Rights Reserved
4 
6 
7 Permission is hereby granted, free of charge, to any
8 person obtaining a copy of this software and
9 associated documentation files (the "Software"), to
10 deal in the Software without restriction, including
11 without limitation the rights to use, copy, modify,
12 merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom
14 the Software is furnished to do so, subject to the
15 following conditions:
16 
17 The above copyright notice and this permission notice
18 shall be included in all copies or substantial
19 portions of the Software.
20 
21 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
22 ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
23 LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
24 FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
25 EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
27 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
28 ARISING FROM, OUT OF OR IN CONNECTION WITH THE
29 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30 SOFTWARE.
31 
32 */
33 
34 #include "as2js/node.h"
35 
36 #include "as2js/exceptions.h"
37 
38 
50 namespace as2js
51 {
52 
53 
54 
55 /**********************************************************************/
56 /**********************************************************************/
57 /*** NODE ***********************************************************/
58 /**********************************************************************/
59 /**********************************************************************/
60 
61 
69 namespace
70 {
71 
79 {
85 
90  char const * f_name;
91 
97  int f_line;
98 };
99 
104 #define TO_STR_sub(s) #s
105 
120 #define NODE_TYPE_NAME(node) { Node::node_t::NODE_##node, TO_STR_sub(node), __LINE__ }
121 
135 {
136  // EOF is -1 on most C/C++ computers... so we have to do this one by hand
137  { Node::node_t::NODE_EOF, "EOF", __LINE__ },
138  NODE_TYPE_NAME(UNKNOWN),
139 
140  // the one character types have to be ordered by their character
141  // which means it does not match the alphabetical order we
142  // generally use
143  NODE_TYPE_NAME(LOGICAL_NOT), // 0x21
144  NODE_TYPE_NAME(MODULO), // 0x25
145  NODE_TYPE_NAME(BITWISE_AND), // 0x26
146  NODE_TYPE_NAME(OPEN_PARENTHESIS), // 0x28
147  NODE_TYPE_NAME(CLOSE_PARENTHESIS), // 0x29
148  NODE_TYPE_NAME(MULTIPLY), // 0x2A
149  NODE_TYPE_NAME(ADD), // 0x2B
150  NODE_TYPE_NAME(COMMA), // 0x2C
151  NODE_TYPE_NAME(SUBTRACT), // 0x2D
152  NODE_TYPE_NAME(MEMBER), // 0x2E
153  NODE_TYPE_NAME(DIVIDE), // 0x2F
154  NODE_TYPE_NAME(COLON), // 0x3A
155  NODE_TYPE_NAME(SEMICOLON), // 0x3B
156  NODE_TYPE_NAME(LESS), // 0x3C
157  NODE_TYPE_NAME(ASSIGNMENT), // 0x3D
158  NODE_TYPE_NAME(GREATER), // 0x3E
159  NODE_TYPE_NAME(CONDITIONAL), // 0x3F
160  NODE_TYPE_NAME(OPEN_SQUARE_BRACKET), // 0x5B
161  NODE_TYPE_NAME(CLOSE_SQUARE_BRACKET), // 0x5D
162  NODE_TYPE_NAME(BITWISE_XOR), // 0x5E
163  NODE_TYPE_NAME(OPEN_CURVLY_BRACKET), // 0x7B
164  NODE_TYPE_NAME(BITWISE_OR), // 0x7C
165  NODE_TYPE_NAME(CLOSE_CURVLY_BRACKET), // 0x7D
166  NODE_TYPE_NAME(BITWISE_NOT), // 0x7E
167 
168  NODE_TYPE_NAME(ABSTRACT),
169  NODE_TYPE_NAME(ARRAY),
170  NODE_TYPE_NAME(ARRAY_LITERAL),
171  NODE_TYPE_NAME(AS),
172  NODE_TYPE_NAME(ASSIGNMENT_ADD),
173  NODE_TYPE_NAME(ASSIGNMENT_BITWISE_AND),
174  NODE_TYPE_NAME(ASSIGNMENT_BITWISE_OR),
175  NODE_TYPE_NAME(ASSIGNMENT_BITWISE_XOR),
176  NODE_TYPE_NAME(ASSIGNMENT_DIVIDE),
177  NODE_TYPE_NAME(ASSIGNMENT_LOGICAL_AND),
178  NODE_TYPE_NAME(ASSIGNMENT_LOGICAL_OR),
179  NODE_TYPE_NAME(ASSIGNMENT_LOGICAL_XOR),
180  NODE_TYPE_NAME(ASSIGNMENT_MAXIMUM),
181  NODE_TYPE_NAME(ASSIGNMENT_MINIMUM),
182  NODE_TYPE_NAME(ASSIGNMENT_MODULO),
183  NODE_TYPE_NAME(ASSIGNMENT_MULTIPLY),
184  NODE_TYPE_NAME(ASSIGNMENT_POWER),
185  NODE_TYPE_NAME(ASSIGNMENT_ROTATE_LEFT),
186  NODE_TYPE_NAME(ASSIGNMENT_ROTATE_RIGHT),
187  NODE_TYPE_NAME(ASSIGNMENT_SHIFT_LEFT),
188  NODE_TYPE_NAME(ASSIGNMENT_SHIFT_RIGHT),
189  NODE_TYPE_NAME(ASSIGNMENT_SHIFT_RIGHT_UNSIGNED),
190  NODE_TYPE_NAME(ASSIGNMENT_SUBTRACT),
191  NODE_TYPE_NAME(ATTRIBUTES),
192  NODE_TYPE_NAME(AUTO),
193  NODE_TYPE_NAME(BOOLEAN),
194  NODE_TYPE_NAME(BREAK),
195  NODE_TYPE_NAME(BYTE),
196  NODE_TYPE_NAME(CALL),
197  NODE_TYPE_NAME(CASE),
198  NODE_TYPE_NAME(CATCH),
199  NODE_TYPE_NAME(CHAR),
200  NODE_TYPE_NAME(CLASS),
201  NODE_TYPE_NAME(COMPARE),
202  NODE_TYPE_NAME(CONST),
203  NODE_TYPE_NAME(CONTINUE),
204  NODE_TYPE_NAME(DEBUGGER),
205  NODE_TYPE_NAME(DECREMENT),
206  NODE_TYPE_NAME(DEFAULT),
207  NODE_TYPE_NAME(DELETE),
208  NODE_TYPE_NAME(DIRECTIVE_LIST),
209  NODE_TYPE_NAME(DO),
210  NODE_TYPE_NAME(DOUBLE),
211  NODE_TYPE_NAME(ELSE),
212  NODE_TYPE_NAME(EMPTY),
213  NODE_TYPE_NAME(ENSURE),
214  NODE_TYPE_NAME(ENUM),
215  NODE_TYPE_NAME(EQUAL),
216  NODE_TYPE_NAME(EXCLUDE),
217  NODE_TYPE_NAME(EXTENDS),
218  NODE_TYPE_NAME(EXPORT),
219  NODE_TYPE_NAME(FALSE),
220  NODE_TYPE_NAME(FINAL),
221  NODE_TYPE_NAME(FINALLY),
222  NODE_TYPE_NAME(FLOAT),
223  NODE_TYPE_NAME(FLOAT64),
224  NODE_TYPE_NAME(FOR),
225  NODE_TYPE_NAME(FUNCTION),
226  NODE_TYPE_NAME(GOTO),
227  NODE_TYPE_NAME(GREATER_EQUAL),
228  NODE_TYPE_NAME(IDENTIFIER),
229  NODE_TYPE_NAME(IF),
230  NODE_TYPE_NAME(IMPLEMENTS),
231  NODE_TYPE_NAME(IMPORT),
232  NODE_TYPE_NAME(IN),
233  NODE_TYPE_NAME(INCLUDE),
234  NODE_TYPE_NAME(INCREMENT),
235  NODE_TYPE_NAME(INLINE),
236  NODE_TYPE_NAME(INSTANCEOF),
237  NODE_TYPE_NAME(INT64),
238  NODE_TYPE_NAME(INTERFACE),
239  NODE_TYPE_NAME(INVARIANT),
240  NODE_TYPE_NAME(IS),
241  NODE_TYPE_NAME(LABEL),
242  NODE_TYPE_NAME(LESS_EQUAL),
243  NODE_TYPE_NAME(LIST),
244  NODE_TYPE_NAME(LOGICAL_AND),
245  NODE_TYPE_NAME(LOGICAL_OR),
246  NODE_TYPE_NAME(LOGICAL_XOR),
247  NODE_TYPE_NAME(LONG),
248  NODE_TYPE_NAME(MATCH),
249  NODE_TYPE_NAME(MAXIMUM),
250  NODE_TYPE_NAME(MINIMUM),
251  NODE_TYPE_NAME(NAME),
252  NODE_TYPE_NAME(NAMESPACE),
253  NODE_TYPE_NAME(NATIVE),
254  NODE_TYPE_NAME(NEW),
255  NODE_TYPE_NAME(NOT_EQUAL),
256  NODE_TYPE_NAME(NOT_MATCH),
257  //NODE_TYPE_NAME(NULL), -- macro does not work in this case
258  { Node::node_t::NODE_NULL, "NULL", __LINE__ },
259  NODE_TYPE_NAME(OBJECT_LITERAL),
260  NODE_TYPE_NAME(PACKAGE),
261  NODE_TYPE_NAME(PARAM),
262  NODE_TYPE_NAME(PARAMETERS),
263  NODE_TYPE_NAME(PARAM_MATCH),
264  NODE_TYPE_NAME(POST_DECREMENT),
265  NODE_TYPE_NAME(POST_INCREMENT),
266  NODE_TYPE_NAME(POWER),
267  NODE_TYPE_NAME(PRIVATE),
268  NODE_TYPE_NAME(PROGRAM),
269  NODE_TYPE_NAME(PROTECTED),
270  NODE_TYPE_NAME(PUBLIC),
271  NODE_TYPE_NAME(RANGE),
272  NODE_TYPE_NAME(REGULAR_EXPRESSION),
273  NODE_TYPE_NAME(REQUIRE),
274  NODE_TYPE_NAME(REST),
275  NODE_TYPE_NAME(RETURN),
276  NODE_TYPE_NAME(ROOT),
277  NODE_TYPE_NAME(ROTATE_LEFT),
278  NODE_TYPE_NAME(ROTATE_RIGHT),
279  NODE_TYPE_NAME(SCOPE),
280  NODE_TYPE_NAME(SET),
281  NODE_TYPE_NAME(SHIFT_LEFT),
282  NODE_TYPE_NAME(SHIFT_RIGHT),
283  NODE_TYPE_NAME(SHIFT_RIGHT_UNSIGNED),
284  NODE_TYPE_NAME(SHORT),
285  NODE_TYPE_NAME(SMART_MATCH),
286  NODE_TYPE_NAME(STATIC),
287  NODE_TYPE_NAME(STRICTLY_EQUAL),
288  NODE_TYPE_NAME(STRICTLY_NOT_EQUAL),
289  NODE_TYPE_NAME(STRING),
290  NODE_TYPE_NAME(SUPER),
291  NODE_TYPE_NAME(SWITCH),
292  NODE_TYPE_NAME(SYNCHRONIZED),
293  NODE_TYPE_NAME(THEN),
294  NODE_TYPE_NAME(THIS),
295  NODE_TYPE_NAME(THROW),
296  NODE_TYPE_NAME(THROWS),
297  NODE_TYPE_NAME(TRANSIENT),
298  NODE_TYPE_NAME(TRUE),
299  NODE_TYPE_NAME(TRY),
300  NODE_TYPE_NAME(TYPE),
301  NODE_TYPE_NAME(TYPEOF),
302  NODE_TYPE_NAME(UNDEFINED),
303  NODE_TYPE_NAME(USE),
304  NODE_TYPE_NAME(VAR),
305  NODE_TYPE_NAME(VARIABLE),
306  NODE_TYPE_NAME(VAR_ATTRIBUTES),
307  NODE_TYPE_NAME(VIDENTIFIER),
308  NODE_TYPE_NAME(VOID),
309  NODE_TYPE_NAME(VOLATILE),
310  NODE_TYPE_NAME(WHILE),
311  NODE_TYPE_NAME(WITH),
312  NODE_TYPE_NAME(YIELD),
313 };
314 
319 size_t const g_node_type_name_size = sizeof(g_node_type_name) / sizeof(g_node_type_name[0]);
320 
321 
322 }
323 // no name namespace
324 
325 
368 {
369  return f_type;
370 }
371 
372 
396 char const *Node::type_to_string(node_t type)
397 {
398 #if defined(_DEBUG) || defined(DEBUG)
399  {
400  // make sure that the node types are properly sorted
401  static bool checked = false;
402  if(!checked)
403  {
404  // check only once
405  checked = true;
406  for(size_t idx = 1; idx < g_node_type_name_size; ++idx)
407  {
408  if(g_node_type_name[idx].f_type <= g_node_type_name[idx - 1].f_type)
409  {
410  // if the table is properly defined then we cannot reach
411  // these lines
412  std::cerr << "INTERNAL ERROR at offset " << idx // LCOV_EXCL_LINE
413  << " (line #" << g_node_type_name[idx].f_line // LCOV_EXCL_LINE
414  << ", node type " << static_cast<uint32_t>(g_node_type_name[idx].f_type) // LCOV_EXCL_LINE
415  << " vs. " << static_cast<uint32_t>(g_node_type_name[idx - 1].f_type) // LCOV_EXCL_LINE
416  << "): the g_node_type_name table is not sorted properly. We cannot binary search it." // LCOV_EXCL_LINE
417  << std::endl; // LCOV_EXCL_LINE
418  throw exception_internal_error("INTERNAL ERROR: node type names not properly sorted, cannot properly search for names using a binary search."); // LCOV_EXCL_LINE
419  }
420  }
421  }
422  }
423 #endif
424 
425  size_t i(0);
426  size_t j(g_node_type_name_size);
427  while(i < j)
428  {
429  size_t p((j - i) / 2 + i);
430  int r(static_cast<int>(g_node_type_name[p].f_type) - static_cast<int>(static_cast<node_t>(type)));
431  if(r == 0)
432  {
433  return g_node_type_name[p].f_name;
434  }
435  if(r < 0)
436  {
437  i = p + 1;
438  }
439  else
440  {
441  j = p;
442  }
443  }
444 
445  throw exception_internal_error("INTERNAL ERROR: node type name not found!?."); // LCOV_EXCL_LINE
446 }
447 
448 
450 {
451  f_type_node = node;
452 }
453 
454 
456 {
457  return f_type_node.lock();
458 }
459 
460 
475 char const *Node::get_type_name() const
476 {
477  return type_to_string(f_type);
478 }
479 
480 
507 bool Node::is_number() const
508 {
509  return f_type == node_t::NODE_INT64 || f_type == node_t::NODE_FLOAT64;
510 }
511 
512 
539 bool Node::is_nan() const
540 {
541  if(f_type == node_t::NODE_STRING)
542  {
543  return f_str.is_number();
544  }
545 
546  return f_type != node_t::NODE_INT64
547  && f_type != node_t::NODE_FLOAT64
548  && f_type != node_t::NODE_TRUE
549  && f_type != node_t::NODE_FALSE
550  && f_type != node_t::NODE_NULL;
551 }
552 
553 
572 bool Node::is_int64() const
573 {
574  return f_type == node_t::NODE_INT64;
575 }
576 
577 
596 bool Node::is_float64() const
597 {
598  return f_type == node_t::NODE_FLOAT64;
599 }
600 
601 
621 bool Node::is_boolean() const
622 {
623  return f_type == node_t::NODE_TRUE || f_type == node_t::NODE_FALSE;
624 }
625 
626 
645 bool Node::is_true() const
646 {
647  return f_type == node_t::NODE_TRUE;
648 }
649 
650 
669 bool Node::is_false() const
670 {
671  return f_type == node_t::NODE_FALSE;
672 }
673 
674 
693 bool Node::is_string() const
694 {
695  return f_type == node_t::NODE_STRING;
696 }
697 
698 
717 bool Node::is_undefined() const
718 {
719  return f_type == node_t::NODE_UNDEFINED;
720 }
721 
722 
741 bool Node::is_null() const
742 {
743  return f_type == node_t::NODE_NULL;
744 }
745 
746 
767 {
768  return f_type == node_t::NODE_IDENTIFIER || f_type == node_t::NODE_VIDENTIFIER;
769 }
770 
771 
800 bool Node::is_literal() const
801 {
802  switch(f_type)
803  {
804  case node_t::NODE_FALSE:
805  case node_t::NODE_FLOAT64:
806  case node_t::NODE_INT64:
807  case node_t::NODE_NULL:
808  case node_t::NODE_STRING:
809  case node_t::NODE_TRUE:
810  case node_t::NODE_UNDEFINED:
811  return true;
812 
813  default:
814  return false;
815 
816  }
817 }
818 
819 
865 {
866  //
867  // Well... I'm wondering if we can really
868  // trust this current version.
869  //
870  // Problem I:
871  // some identifiers can be getters and
872  // they can have side effects; though
873  // a getter should be considered constant
874  // toward the object being read and thus
875  // it should be fine in 99% of cases
876  // [imagine a serial number generator
877  // though...]
878  //
879  // Problem II:
880  // some operators may not have been
881  // compiled yet and they could have
882  // side effects too; now this is much
883  // less likely a problem because then
884  // the programmer is most certainly
885  // creating a really weird program
886  // with all sorts of side effects that
887  // he wants no one else to know about,
888  // etc. etc. etc.
889  //
890  // Problem III:
891  // Note that we do not memorize whether
892  // a node has side effects because its
893  // children may change and then side
894  // effects may appear and disappear.
895  //
896 
897  switch(f_type)
898  {
899  case node_t::NODE_ASSIGNMENT:
900  case node_t::NODE_ASSIGNMENT_ADD:
901  case node_t::NODE_ASSIGNMENT_BITWISE_AND:
902  case node_t::NODE_ASSIGNMENT_BITWISE_OR:
903  case node_t::NODE_ASSIGNMENT_BITWISE_XOR:
904  case node_t::NODE_ASSIGNMENT_DIVIDE:
905  case node_t::NODE_ASSIGNMENT_LOGICAL_AND:
906  case node_t::NODE_ASSIGNMENT_LOGICAL_OR:
907  case node_t::NODE_ASSIGNMENT_LOGICAL_XOR:
908  case node_t::NODE_ASSIGNMENT_MAXIMUM:
909  case node_t::NODE_ASSIGNMENT_MINIMUM:
910  case node_t::NODE_ASSIGNMENT_MODULO:
911  case node_t::NODE_ASSIGNMENT_MULTIPLY:
912  case node_t::NODE_ASSIGNMENT_POWER:
913  case node_t::NODE_ASSIGNMENT_ROTATE_LEFT:
914  case node_t::NODE_ASSIGNMENT_ROTATE_RIGHT:
915  case node_t::NODE_ASSIGNMENT_SHIFT_LEFT:
916  case node_t::NODE_ASSIGNMENT_SHIFT_RIGHT:
917  case node_t::NODE_ASSIGNMENT_SHIFT_RIGHT_UNSIGNED:
918  case node_t::NODE_ASSIGNMENT_SUBTRACT:
919  case node_t::NODE_CALL:
920  case node_t::NODE_DECREMENT:
921  case node_t::NODE_DELETE:
922  case node_t::NODE_INCREMENT:
923  case node_t::NODE_NEW:
924  case node_t::NODE_POST_DECREMENT:
925  case node_t::NODE_POST_INCREMENT:
926  return true;
927 
928  //case NODE_IDENTIFIER:
929  //
930  // TODO: Test whether this is a reference to a [sg]etter
931  // function (needs to be compiled already...)
932  //
933  // break;
934 
935  default:
936  break;
937 
938  }
939 
940  for(size_t idx(0); idx < f_children.size(); ++idx)
941  {
942  if(f_children[idx] && f_children[idx]->has_side_effects())
943  {
944  return true;
945  }
946  }
947 
948  return false;
949 }
950 
951 
952 //
953 // This is not needed, plus it is wrong. We instead use the get_type_node()
954 // and compare those pointers. I keep the function for now, but ti is most
955 // certainly totally useless.
956 //
957 // /** \brief Transform a node of type NODE_TYPE to a string.
958 // *
959 // * This function transforms a type definition into a string. This can be
960 // * used to determine whether two different types are equal without having
961 // * to test a complicated set of nodes.
962 // *
963 // * \note
964 // * The definition of this function may need to be in a different
965 // * file instead of the node_type.cpp file. It is not linked to
966 // * the type of a node, it concerns a high level type definition.
967 // *
968 // * \exception exception_internal_error
969 // * This exception is raised if the input node is not a NODE_TYPE or
970 // * the node does not have 0 or 1 child.
971 // *
972 // * \return A string representing the type of "*" if it cannot be converted.
973 // */
974 // String Node::type_node_to_string() const
975 // {
976 // if(f_type != Node::node_t::NODE_TYPE)
977 // {
978 // throw exception_internal_error("node_type.cpp: Node::type_node_to_string(): called with a node which is not a NODE_TYPE.");
979 // }
980 //
981 // // any children? (we should have exactly one)
982 // switch(get_children_size())
983 // {
984 // case 0:
985 // return "";
986 //
987 // case 1:
988 // break;
989 //
990 // default:
991 // throw exception_internal_error("node_type.cpp: Node::type_node_to_string(): called with a NODE_TYPE that has more than one child.");
992 //
993 // }
994 //
995 // // we want to use a recursive function
996 // class t2s
997 // {
998 // public:
999 // static String convert(Node::pointer_t node, bool & unknown)
1000 // {
1001 // switch(node->get_type())
1002 // {
1003 // case Node::node_t::NODE_IDENTIFIER:
1004 // case Node::node_t::NODE_VIDENTIFIER:
1005 // case Node::node_t::NODE_STRING:
1006 // return node->get_string();
1007 //
1008 // case Node::node_t::NODE_MEMBER:
1009 // if(node->get_children_size() != 2)
1010 // {
1011 // unknown = true;
1012 // return "";
1013 // }
1014 // return convert(node->get_child(0), unknown) + "." + convert(node->get_child(1), unknown);
1015 //
1016 // default:
1017 // unknown = true;
1018 // return "";
1019 //
1020 // }
1021 // /*NOTREACHED*/
1022 // }
1023 // };
1024 //
1025 // bool unknown(false);
1026 // String const result(t2s::convert(get_child(0), unknown));
1027 // if(unknown)
1028 // {
1029 // return "*";
1030 // }
1031 //
1032 // return result;
1033 // }
1034 
1035 
1036 }
1037 // namespace as2js
1038 
1039 // vim: ts=4 sw=4 et
bool has_side_effects() const
Check whether a node has side effects.
Definition: node_type.cpp:864
pointer_t get_type_node() const
Definition: node_type.cpp:455
int f_line
The line number of the definition.
Definition: node_type.cpp:97
bool is_null() const
Check whether a node is the special value null.
Definition: node_type.cpp:741
bool is_literal() const
Check whether this node represents a literal.
Definition: node_type.cpp:800
bool is_undefined() const
Check whether a node is the special value undefined.
Definition: node_type.cpp:717
static char const * type_to_string(node_t type)
Convert the specified type to a string.
Definition: node_type.cpp:396
bool is_boolean() const
Check whether a node is a Boolean value.
Definition: node_type.cpp:621
size_t const g_node_type_name_size
Define the size of the node type table.
Definition: node_type.cpp:319
bool is_float64() const
Check whether a node is a floating point.
Definition: node_type.cpp:596
void set_type_node(Node::pointer_t node)
Definition: node_type.cpp:449
bool is_true() const
Check whether a node represents the true Boolean value.
Definition: node_type.cpp:645
bool is_nan() const
Check whether this node represents a NaN if converted to a number.
Definition: node_type.cpp:539
bool is_false() const
Check whether a node represents the false Boolean value.
Definition: node_type.cpp:669
std::shared_ptr< Node > pointer_t
Definition: node.h:67
bool is_identifier() const
Check whether a node is an identifier.
Definition: node_type.cpp:766
bool is_number() const
Return true if Node represents a number.
Definition: node_type.cpp:507
bool is_string() const
Check whether a node is a string.
Definition: node_type.cpp:693
#define NODE_TYPE_NAME(node)
Macro used to add a named type to the table of node types.
Definition: node_type.cpp:120
type_name_t const g_node_type_name[]
List of node types with their name.
Definition: node_type.cpp:134
The AlexScript to JavaScript namespace.
Definition: compiler.cpp:37
bool is_int64() const
Check whether a node is an integer.
Definition: node_type.cpp:572
char const * f_name
The name of the node type.
Definition: node_type.cpp:90
node_t get_type() const
Retrieve the type of the node.
Definition: node_type.cpp:367
Structure used to define the name of each node type.
Definition: node_type.cpp:78
char const * get_type_name() const
Retrieve the type of this node.
Definition: node_type.cpp:475

This document is part of the Snap! Websites Project.

Copyright by Made to Order Software Corp.

Syndicate content

Snap! Websites
An Open Source CMS System in C++

Contact Us Directly