public override void visit(char_const _char_const)
 {
     //throw new NotImplementedException();
 }
 public char_const create_char_const(string text, SourceContext sc)
 {
     string char_text = new string(text.ToCharArray(1, text.Length - 2));
     char_text = ReplaceSpecialSymbols(char_text);
     char_const ct = new char_const();
     ct.source_context = sc;
     if (char_text.Length == 1)
     {
         ct.cconst = char_text[0];
         return ct;
     }
     return null;
 }
 public literal create_string_const(string text, SourceContext sc)
 {
     literal lt;
     if (text.Length == 3 && text[0] == '\'' && text[2] == '\'')
     {
         lt = new char_const(text[1]);
         lt.source_context = sc;
         return lt;
     }
     text = ReplaceSpecialSymbols(text.Substring(1, text.Length - 2));
     lt = new string_const(text);
     lt.source_context = sc;
     return lt;
 }
 public override void visit(char_const _char_const)
 {
     returned_scope = TypeTable.char_type;//entry_scope.FindName(PascalABCCompiler.TreeConverter.compiler_string_consts.char_type_name);
     if (in_kav)
     	cnst_val.prim_val = this.converter.controller.Parser.LanguageInformation.GetStringForChar(_char_const.cconst);
     //cnst_val.prim_val = "'"+_char_const.cconst.ToString()+"'";
     else cnst_val.prim_val = _char_const.cconst;
 }
 public override void visit(char_const _char_const)
 {
     AddPossibleComments(_char_const, true, true);
 }
		public override void visit(char_const _char_const)
		{
			//throw new NotImplementedException();
			returned_scope = new ElementScope(TypeTable.char_type);
		}
		public void read_char_const(char_const _char_const)
		{
			read_literal(_char_const);
			_char_const.cconst = br.ReadChar();
		}
		public void visit(char_const _char_const)
		{
			bw.Write((Int16)87);
			write_char_const(_char_const);
		}
Exemple #9
0
		public override void visit(char_const _char_const)
		{
			
		}
		public void visit(char_const _char_const)
		{
			read_char_const(_char_const);
		}
 public override void visit(char_const _char_const)
 {
     sb.Append("'");
     sb.Append(_char_const.cconst.ToString());
     sb.Append("'");
 }
 public void CompareInternal(char_const left, char_const right)
 {
     if (left == null && right != null || left != null && right == null)
         throw_not_equal(left, right);
     if (left != null && right != null)
     {
         if (left.cconst != right.cconst)
             throw_not_equal(left, right);
     }
 }
 public override void visit(char_const _char_const)
 {
     RetValue val = new RetValue();
     val.prim_val = _char_const.cconst;
     eval_stack.Push(val);
     names.Add("'" + _char_const.cconst.ToString() + "'");
 }
		public virtual literal create_string_const(GPBParser parser)
		{
			literal lt;
            string text = parser.LRParser.TokenString;
			if (text.Length==3 && text[0]=='\'' && text[2]=='\'')
			{
				lt=new char_const(text[1]);
                lt.source_context = GetTokenSourceContext(parser.LRParser);//create_source_context(token);
				return lt;
			}
            text = ReplaceSpecialSymbols(text.Substring(1, text.Length - 2));
			lt=new string_const(text);
            lt.source_context = GetTokenSourceContext(parser.LRParser);//create_source_context(token);
			return lt;
			
		}
Exemple #15
0
 public virtual char_const create_char_const(string text,LexLocation loc)
 {
     string char_text = new string(text.ToCharArray(1,text.Length - 2));
     SourceContext sc = GetTokenSourceContext(loc);
     char_text = ReplaceSpecialSymbols(char_text);
     char_const ct = new char_const();
     ct.source_context = sc;
     if (char_text.Length == 1)
     {
         ct.cconst = char_text[0];
         return ct;
     }
     return null;
 }
Exemple #16
0
        public static procedure_definition BuildToStringFuncForAutoClass(List<ident> names)
        {
            var pal = new procedure_attributes_list(proc_attribute.attr_override);
            var fp = new formal_parameters();
            var ff = new function_header("ToString", "string", fp, pal);

            var cleft = new char_const('(');
            var cright = new char_const(')');
            var ccomma = new char_const(',');
            bin_expr ex = new bin_expr(cleft, cright, Operators.Plus);
            for (var i = 0; i < names.Count; i++)
            { 
                var dn = new dot_node(names[i], new ident("ToString"));
                var asnode = new typecast_node(names[i], new named_type_reference("object"), op_typecast.as_op);
                var eqnode = new bin_expr(asnode, new nil_const(), Operators.Equal);
                var expr = new question_colon_expression(eqnode, new string_const("nil"), dn);
                ex.left = new bin_expr(ex.left, expr, Operators.Plus);
                if (i<names.Count-1)
                    ex.left = new bin_expr(ex.left, ccomma, Operators.Plus);
            }
            var ass = new assign("Result", ex);

            return BuildShortProcFuncDefinitionNoSC(ff, ass);
        }
Exemple #17
0
        public virtual literal create_string_const(string text,LexLocation loc)
        {
            literal lt;
            if (text.Length == 3 && text[0] == '\'' && text[2] == '\'')
            {
                lt = new char_const(text[1]);
                lt.source_context = GetTokenSourceContext(loc);
                return lt;
            }
            string text1 = ReplaceSpecialSymbols(text.Substring(1, text.Length - 2));
            lt = new string_const(text1);
            lt.source_context = GetTokenSourceContext(loc);
            return lt;

        }
		public void write_char_const(char_const _char_const)
		{
			write_literal(_char_const);
			bw.Write(_char_const.cconst);
		}
		public override void visit(char_const _char_const)
		{
			text="Value: "+_char_const.cconst;
		}