Package compilework;
Import java.util.ArrayList;
Import Java.util.Scanner;
public class Compilework_1
{
public static void Main (String args[])
{
Scanner s=new Scanner (system.in);
SYSTEM.OUT.PRINTLN ("Please input Code");
String Scode=s.nextline ();
S.close ();
Arraylist<string> arrayphrase=new arraylist<string> ();
for (int i=0;i<scode.length (); i++)
{
Char[] Stemp=scode.substring (i, i+1). ToCharArray ();
Char cword=stemp[0];
String sphrase= "";
int flag=0;
while (I<scode.length () &&cword<= ' Z ' &&cword>= ' A ' | | Cword<= ' z ' &&cword>= ' a ' | | cword>= ' 0 ' &&cword<= ' 9 ')
{
i++;
Sphrase+=cword;
Char[] Cnexttemp=scode.substring (i,i+1). ToCharArray ();
CWORD=CNEXTTEMP[0];
}
if (flag==1) {
Arrayphrase.add (sphrase);
Sphrase= "";
}
if (i<scode.length () &&cword== ' < ')
{
i++;
Sphrase+=cword;
Char[] Cnexttemp=scode.substring (i,i+1). ToCharArray ();
CWORD=CNEXTTEMP[0];
if (I<scode.length () &&i<scode.length () &&cword== ' = ')
{
i++;
Sphrase+=cword;
}
if (i<scode.length () &&cword== ' > ')
{
i++;
Sphrase+=cword;
}
Arrayphrase.add (sphrase);
Sphrase= "";
}
if (i<scode.length () &&cword== ': ')
{
i++;
Sphrase+=cword;
Char[] Cnexttemp=scode.substring (i,i+1). ToCharArray ();
CWORD=CNEXTTEMP[0];
if (I<scode.length () &&i<scode.length () &&cword== ' = ')
{
i++;
Sphrase+=cword;
}
Arrayphrase.add (sphrase);
Sphrase= "";
}
if (i<scode.length () &&cword== ' + ')
{
i++;
Sphrase+=cword;
Arrayphrase.add (sphrase);
}
if (i<scode.length () &&cword== '-')
{
i++;
Sphrase+=cword;
Arrayphrase.add (sphrase);
}
if (i<scode.length () &&cword== ' * ')
{
i++;
Sphrase+=cword;
Arrayphrase.add (sphrase);
}
if (i<scode.length () &&cword== '/')
{
i++;
Sphrase+=cword;
Arrayphrase.add (sphrase);
}
if (i<scode.length () &&cword== ': ')
{
i++;
Sphrase+=cword;
Arrayphrase.add (sphrase);
}
if (I<scode.length ()) {
Sphrase+=cword;
Arrayphrase.add (sphrase);
}
}
for (int j=0;j<6;j++)
{
System.out.print (Arrayphrase.get (j));
}
}
}
The teacher is good because the ability is not enough to complete half of the time will be paid
0916 Lexical analysis