Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace HMcutword
- {
- class Program
- {
- static void Main(string[] args)
- {
- //string label = "int123<float112.33tong$";
- string label = "222in11t=float<==12.22uuu12.$";
- //string label = "==flojjat11.22flo33at$";
- int i = -1;
- char[] charArray = label.ToCharArray(0, label.Length);
- char c;
- string w = " ";
- string x = " ";
- L1: c = getchar(ref i, charArray);
- while (c != '$')
- {
- if (c == 'i') // int
- {
- w += c;
- c = getchar(ref i, charArray);
- if (c != 'n')
- {
- if (Isdigit(c))
- {
- Console.WriteLine(w);
- w = x;
- Unchar(ref i, charArray);
- goto L1;
- }
- else if(Isletter(c))
- {
- goto L1;
- }
- }
- else
- {
- w += c;
- c = getchar(ref i, charArray);
- if (c != 't')
- {
- if (Isdigit(c))
- {
- Console.WriteLine(w);
- w = x;
- Unchar(ref i, charArray);
- goto L1;
- }
- else if (Isletter(c))
- {
- goto L1;
- }
- }
- else
- {
- w += c;
- }
- }
- Console.WriteLine(w);
- w = x;
- goto L1;
- }
- else if (c == 'f') //float
- {
- w += c;
- c = getchar(ref i, charArray);
- if (c != 'l')
- {
- if (Isdigit(c))
- {
- Console.WriteLine(w);
- w = x;
- Unchar(ref i, charArray);
- goto L1;
- }
- else if (Isletter(c))
- {
- goto L1;
- }
- }
- else
- {
- w += c;
- c = getchar(ref i, charArray);
- if (c != 'o')
- {
- if (Isdigit(c))
- {
- Console.WriteLine(w);
- w = x;
- Unchar(ref i, charArray);
- goto L1;
- }
- else if (Isletter(c))
- {
- goto L1;
- }
- }
- else
- {
- w += c;
- c = getchar(ref i, charArray);
- if (c != 'a')
- {
- if (Isdigit(c))
- {
- Console.WriteLine(w);
- w = x;
- Unchar(ref i, charArray);
- goto L1;
- }
- else if (Isletter(c))
- {
- goto L1;
- }
- }
- else
- {
- w += c;
- c = getchar(ref i, charArray);
- if (c != 't')
- {
- if (Isdigit(c))
- {
- Console.WriteLine(w);
- w = x;
- Unchar(ref i, charArray);
- goto L1;
- }
- else if (Isletter(c))
- {
- w += c;
- goto L1;
- }
- }
- else
- {
- w += c;
- //Console.WriteLine(w);
- }
- }
- }
- }
- Console.WriteLine(w);
- w = x;
- goto L1;
- }
- else if (c == '<') //<
- {
- w += c;
- Console.WriteLine(w);
- w = x;
- goto L1;
- }
- else if (c == '=') //= =
- {
- w += c;
- c = getchar(ref i, charArray);
- if (c != '=')
- {
- Console.WriteLine(w);
- w = x;
- Unchar(ref i, charArray);
- goto L1;
- }
- else
- {
- w += c;
- Console.WriteLine(w);
- w = x;
- goto L1;
- }
- }
- else if (Isdigit(c)) //digit int_const or float_const
- {
- w += c;
- c = getchar(ref i, charArray);
- while (Isdigit(c))
- {
- w += c;
- c = getchar(ref i, charArray);
- }
- if (c != '.')
- {
- Console.WriteLine(w);
- w = x;
- Unchar(ref i, charArray);
- goto L1;
- }
- else
- {
- w += c;
- c = getchar(ref i, charArray);
- while (Isdigit(c))
- {
- w += c;
- c = getchar(ref i, charArray);
- }
- Console.WriteLine(w);
- w = x;
- Unchar(ref i, charArray);
- goto L1;
- }
- }
- else if (c == '"') // " " (String)
- {
- w += c;
- c = getchar(ref i, charArray);
- while ((Isdigit(c)) || (Isletter(c)) || (c == '<'))
- {
- w += c;
- c = getchar(ref i, charArray);
- }
- if (c == '"')
- {
- w += c;
- goto L1;
- }
- Console.WriteLine(w);
- }
- else if (Isletter(c)) //letter
- {
- w += c;
- c = getchar(ref i, charArray);
- while (Isletter(c))
- {
- w += c;
- c = getchar(ref i, charArray);
- }
- Console.WriteLine(w);
- Unchar(ref i, charArray);
- w = x;
- goto L1;
- }
- else
- {
- Console.WriteLine("Sezntence end....");
- }
- }
- Console.ReadLine();
- //Console.WriteLine("");
- }
- public static char getchar(ref int i, char[] lebelArray)
- {
- i++;
- char c = lebelArray[i];
- return c;
- }
- public static char Unchar(ref int i, char[] labelArray)
- {
- char c = labelArray[i];
- i--;
- return c;
- }
- public static bool Isletter(char c)
- {
- if ((c >= 'a') && (c <= 'z') || (c >= 'A') && (c <= 'Z'))
- {
- return true;
- }
- return false;
- }
- public static bool Isdigit(char c)
- {
- if ((c >= '0') && (c <= '9'))
- {
- return true;
- }
- return false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement