casserole/nimNodeSupport

Search:
Group by:
Source   Edit  

This module implements support for matching NimNode inside macros. This maps to the ast outlined in the docs

Types

NodeBranch = enum
  NoneNode, Empty, Ident, Sym, Type, CharLit, IntLit, Int8Lit, Int16Lit,
  Int32Lit, Int64Lit, UIntLit, UInt8Lit, UInt16Lit, UInt32Lit, UInt64Lit,
  FloatLit, Float32Lit, Float64Lit, Float128Lit, StrLit, RStrLit, TripleStrLit,
  NilLit, ComesFrom, DotCall, Command, Call, CallStrLit, Infix, Prefix, Postfix,
  HiddenCallConv, ExprEqExpr, ExprColonExpr, IdentDefs, VarTuple, Par,
  ObjConstr, Curly, CurlyExpr, Bracket, BracketExpr, PragmaExpr, Range, DotExpr,
  CheckedFieldExpr, DerefExpr, IfExpr, ElifExpr, ElseExpr, Lambda, Do,
  AccQuoted, TableConstr, Bind, ClosedSymChoice, OpenSymChoice, HiddenStdConv,
  HiddenSubConv, Conv, Cast, StaticExpr, Addr, HiddenAddr, HiddenDeref,
  ObjDownConv, ObjUpConv, ChckRangeF, ChckRange64, ChckRange, StringToCString,
  CStringToString, Asgn, FastAsgn, GenericParams, FormalParams, OfInherit,
  ImportAs, ProcDef, MethodDef, ConverterDef, MacroDef, TemplateDef,
  IteratorDef, OfBranch, ElifBranch, ExceptBranch, Else, AsmStmt, Pragma,
  PragmaBlock, IfStmt, WhenStmt, ForStmt, ParForStmt, WhileStmt, CaseStmt,
  TypeSection, VarSection, LetSection, ConstSection, ConstDef, TypeDef,
  YieldStmt, Defer, TryStmt, Finally, RaiseStmt, ReturnStmt, BreakStmt,
  ContinueStmt, BlockStmt, StaticStmt, DiscardStmt, StmtList, ImportStmt,
  ImportExceptStmt, ExportStmt, ExportExceptStmt, FromStmt, IncludeStmt,
  BindStmt, MixinStmt, UsingStmt, CommentStmt, StmtListExpr, BlockExpr,
  StmtListType, BlockType, With, Without, TypeOfExpr, ObjectTy, TupleTy,
  TupleClassTy, TypeClassTy, StaticTy, RecList, RecCase, RecWhen, RefTy, PtrTy,
  VarTy, ConstTy, OutTy, DistinctTy, ProcTy, IteratorTy, SinkAsgn, EnumTy,
  EnumFieldDef, ArgList, Pattern, HiddenTryStmt, Closure, GotoState, State,
  BreakState, FuncDef, TupleConstr, Error, ModuleRef, ReplayAction, NilRodNode,
  OpenSym
Source   Edit  

Procs

proc currentBranch(node: NimNode): NodeBranch {....raises: [], tags: [],
    forbids: [].}
Maps NimNodeKind to our simplified kind Source   Edit  
proc getBranch(node: NimNode; branch: static[NodeBranch]): tuple
Returns values like shown in the docs Source   Edit