本文整理汇总了C#中PascalABCCompiler.SyntaxTree.expression类的典型用法代码示例。如果您正苦于以下问题:C# expression类的具体用法?C# expression怎么用?C# expression使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
expression类属于PascalABCCompiler.SyntaxTree命名空间,在下文中一共展示了expression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NewAsIsConstexpr
public typecast_node NewAsIsConstexpr(expression constterm, op_typecast typecastop, type_definition tdef, LexLocation loc)
{
var naic = new typecast_node(constterm as addressed_value, tdef, typecastop, loc);
if (!(constterm is addressed_value))
parsertools.errors.Add(new bad_operand_type(parsertools.CurrentFileName, constterm.source_context, naic));
return naic;
}
示例2: CreateWhile
/// <summary>
/// Создать цикл while
/// </summary>
/// <param name="condition">Условие цикла</param>
/// <param name="body">Тело цикла</param>
/// <returns></returns>
public SyntaxTree.while_node CreateWhile(expression condition, statement body)
{
SyntaxTree.while_node res = new SyntaxTree.while_node();
res.CycleType = WhileCycleType.While;
res.expr = condition;
res.statements = body;
return res;
}
示例3: GetName
/// <summary>
/// Получение имен после точки
/// </summary>
public SymInfo[] GetName(expression expr, string str, int line, int col, PascalABCCompiler.Parsers.KeywordKind keyword, ref SymScope root)
{
if (visitor.cur_scope == null) return null;
if (col + 1 > str.Length)
col -= str.Length;
SymScope si = visitor.FindScopeByLocation(line + 1, col + 1);//stv.cur_scope;
if (si == null)
{
si = visitor.FindScopeByLocation(line, col + 1);
if (si == null)
return null;
}
SetCurrentUsedAssemblies();
ExpressionVisitor ev = new ExpressionVisitor(expr, si, visitor);
si = ev.GetScopeOfExpression(true, false);
root = si;
if (si is ElementScope) root = (si as ElementScope).sc;
else if (si is ProcScope) root = (si as ProcScope).return_type;
if (si != null)
{
if (!(si is TypeScope) && !(si is NamespaceScope))
{
SymInfo[] syms = si.GetNamesAsInObject(ev);
SymInfo[] ext_syms = null;
if (si is ElementScope)
ext_syms = visitor.cur_scope.GetSymInfosForExtensionMethods((si as ElementScope).sc as TypeScope);
List<SymInfo> lst = new List<SymInfo>();
lst.AddRange(syms);
if (ext_syms != null)
lst.AddRange(ext_syms);
RestoreCurrentUsedAssemblies();
List<SymInfo> lst_to_remove = new List<SymInfo>();
foreach (SymInfo si2 in lst)
if (si2.name.StartsWith("operator"))
lst_to_remove.Add(si2);
foreach (SymInfo si2 in lst_to_remove)
lst.Remove(si2);
return lst.ToArray();
}
else
{
if (si is TypeScope)
{
RestoreCurrentUsedAssemblies();
return (si as TypeScope).GetNames(ev, keyword, false);
}
else
{
if (ev.entry_scope.InUsesRange(line + 1, col + 1))
keyword = PascalABCCompiler.Parsers.KeywordKind.Uses;
RestoreCurrentUsedAssemblies();
return (si as NamespaceScope).GetNames(ev, keyword);
}
}
}
RestoreCurrentUsedAssemblies();
return null;
}
示例4: CreateVarDef
/// <summary>
/// Создать var-выражение
/// </summary>
/// <param name="name">Имя переменной</param>
/// <param name="initialValue">Начальное значение</param>
/// <returns></returns>
public var_def_statement CreateVarDef(string name, expression initialValue)
{
ident_list list = new ident_list();
list.idents.Add(new ident(name));
var res = new var_def_statement();
res.inital_value = initialValue;
res.vars = list;
return res;
}
示例5: CreateFor
/// <summary>
/// Создать цикл for
/// </summary>
/// <param name="varName">Имя переменной цикла</param>
/// <param name="initValue">Начальное значение переменной цикла</param>
/// <param name="finishValue">Конечное значение переменной цикла</param>
/// <param name="body">Тело цикла</param>
/// <param name="type">Тип цикла(to / downto)</param>
/// <returns></returns>
public SyntaxTree.for_node CreateFor(string varName, expression initValue, expression finishValue, statement body, for_cycle_type type)
{
SyntaxTree.for_node res = new SyntaxTree.for_node();
res.loop_variable = new ident(varName);
res.initial_value = initValue;
res.finish_value = finishValue;
res.statements = body;
res.cycle_type = type;
return res;
}
示例6: NewConstVariable
public expression NewConstVariable(expression constvariable, expression constvariable2, LexLocation loc)
{
if (constvariable2 is dereference)
((dereference)constvariable2).dereferencing_value = (addressed_value)constvariable;
if (constvariable2 is dot_node)
((dot_node)constvariable2).left = (addressed_value)constvariable;
var ncv = constvariable2;
ncv.source_context = loc;
return ncv;
}
示例7: Convert
public int32_const Convert(expression expr)
{
if (expr == null)
return null;
try
{
expr.visit(this);
}
catch
{
return null;
}
if (intStack.Count == 1)
{
int32_const i = new int32_const(intStack.Pop());
i.source_context = expr.source_context;
return i;
}
return null;
}
示例8: NameExprPair
public NameExprPair(ident id, expression ex)
{
this.id = id;
this.ex = ex;
}
示例9: BuildShortFuncDefinition
public static procedure_definition BuildShortFuncDefinition(formal_parameters fp, procedure_attributes_list att, method_name name, type_definition result, expression ex, SourceContext headsc)
{
var ff = new function_header(fp, att, name, null, result, headsc);
procedure_definition pd = BuildShortProcFuncDefinition(ff, new assign("Result", ex, ex.source_context));
return pd;
}
示例10: BuildSameType
public static type_definition BuildSameType(expression ex)
{
return new same_type_node(ex);
}
示例11: write_expression
public void write_expression(expression _expression)
{
write_statement(_expression);
}
示例12: typed_const_definition
///<summary>
///Конструктор с параметрами.
///</summary>
public typed_const_definition(ident _const_name,expression _const_value,type_definition _const_type)
{
this._const_name=_const_name;
this._const_value=_const_value;
this._const_type=_const_type;
}
示例13: typed_parameters
///<summary>
///Конструктор с параметрами.
///</summary>
public typed_parameters(ident_list _idents,type_definition _vars_type,parametr_kind _param_kind,expression _inital_value,SourceContext sc)
{
this._idents=_idents;
this._vars_type=_vars_type;
this._param_kind=_param_kind;
this._inital_value=_inital_value;
source_context = sc;
}
示例14: NewVariable
public expression NewVariable(addressed_value variable, expression var_specifiers, LexLocation loc)
{
if (var_specifiers is dot_node)
{
var dn = (dot_node)var_specifiers;
dn.left = variable;
}
else if (var_specifiers is template_param_list)
{
var tpl = (template_param_list)var_specifiers;
((dot_node)tpl.dereferencing_value).left = variable;
parsertools.create_source_context(tpl.dereferencing_value, variable, tpl.dereferencing_value);
}
else if (var_specifiers is dereference)
{
((dereference)var_specifiers).dereferencing_value = variable;
}
else if (var_specifiers is ident_with_templateparams)
{
((ident_with_templateparams)var_specifiers).name = (addressed_value_funcname)variable;
}
var_specifiers.source_context = loc;
return var_specifiers;
}
示例15: visit
public void visit(expression _expression)
{
bw.Write((Int16)1);
write_expression(_expression);
}