자바 어휘분석기 구현
본 자료는 6페이지 의 미리보기를 제공합니다. 이미지를 클릭하여 주세요.
닫기
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
해당 자료는 6페이지 까지만 미리보기를 제공합니다.
6페이지 이후부터 다운로드 후 확인할 수 있습니다.

본문내용

(k, k+1);
}
jmin = false;
break;
}
if (str.equals("\n"))
{
k = k +1;
st = txtArea_str.substring(k, k+1);
while (st.equals("\n"))
{
k = k + 1;
st = txtArea_str.substring(k, k+1);
}
jmin = false;
break;
}
tok = str.charAt(0);
asc = (int)tok;
// 특수문자인가/????
if (90 >= asc && asc >= 65){break;}
else if (97 <= asc && asc <= 122){break;}
else if ( 48 <= asc && asc <= 57){break;}
else if (34 == asc){break;}
stb.append(str);
k = k+1;
}
int y = stb.length();
if (y > 2)
{
stb.delete(2, 5);
int u = y - 1;
k=k-u;
}
String sta = new String(stb);
if ( jmin == true)
{
if (y == 2)
{
if (sta.equals("++")){}
else if (sta.equals("--")){}
else if (sta.equals("+=")){}
else if (sta.equals("-=")){}
else if (sta.equals("<=")){}
else if (sta.equals(">=")){}
else if (sta.equals("=<")){}
else if (sta.equals("=>")){}
else if (sta.equals("==")){}
else {
k=0;
str = txtArea_str.substring(k, k+1);
stb = new StringBuffer(str);
k = k+1;}
}else { k=0; str = txtArea_str.substring(k, k+1); stb = new StringBuffer(str);k=k+1;}
}
temp = txtArea_str.substring(k);
txtArea_str = temp;
txt_word = txt_word + stb;
return txt_word;
}
// " 문자가 나왔을시..
public String DDaom()
{
int k=0, asc=0;
String str="";
String txt_word="";
String temp="";
String empty = " ";
boolean sw = true;
StringBuffer stb= new StringBuffer("");;
String st="";
str = txtArea_str.substring(k, k+1);
stb.append(str);
k = k+1;
while(sw)
{
str = txtArea_str.substring(k, k+1);
if (str.equals("@")){k=k+1; break;}
if (str.equals(empty))
{
k = k+1;
st = txtArea_str.substring(k, k+1);
while (st.equals(empty))
{
k = k + 1;
st = txtArea_str.substring(k, k+1);
}
break;
}
if (str.equals("\n"))
{
k = k +1;
st = txtArea_str.substring(k, k+1);
while (st.equals("\n"))
{
k = k + 1;
st = txtArea_str.substring(k, k+1);
}
break;
}
char tok = str.charAt(0);
asc = (int)tok;
stb.append(str);
k = k+1;
if (asc == 34) {break;}
}
temp = txtArea_str.substring(k);
txtArea_str = temp;
txt_word = txt_word + stb;
return txt_word;
}
// # 문자가 나왔을시..
public String Shap()
{
int k=0, asc=0;
String str="";
String txt_word="";
String temp="";
String empty = " ";
boolean sw = true;
StringBuffer stb= new StringBuffer("");;
String st="";
str = txtArea_str.substring(k, k+1);
stb.append(str);
k = k+1;
while(sw)
{
str = txtArea_str.substring(k, k+1);
if (str.equals("@")){k=k+1;break;}
if (str.equals(empty))
{
k = k+1;
st = txtArea_str.substring(k, k+1);
while (st.equals(empty))
{
k = k + 1;
st = txtArea_str.substring(k, k+1);
}
break;
}
if (str.equals("\n"))
{
k = k +1;
st = txtArea_str.substring(k, k+1);
while (st.equals("\n"))
{
k = k + 1;
st = txtArea_str.substring(k, k+1);
}
break;
}
char tok = str.charAt(0);
asc = (int)tok;
stb.append(str);
k = k+1;
}
temp = txtArea_str.substring(k);
txtArea_str = temp;
txt_word = txt_word + stb;
return txt_word;
}
}
// 윈도우 프레임 창을 닫게하기 위한 아답터클레스 생성
class WindowCloser extends WindowAdapter
{
public void windowClosing(WindowEvent e)
{
Window win = e.getWindow();
win.setVisible(false);
System.exit(0);
}
}
□ 실행 결과

키워드

  • 가격3,000
  • 페이지수18페이지
  • 등록일2006.05.02
  • 저작시기2003.4
  • 파일형식한글(hwp)
  • 자료번호#347018
본 자료는 최근 2주간 다운받은 회원이 없습니다.
청소해
다운로드 장바구니