1 33 34 package edu.rice.cs.drjava.model.definitions.reducedmodel; 35 36 40 public class Free extends ReducedModelState { 41 public static final Free ONLY = new Free(); 42 43 private Free() { } 44 45 58 ReducedModelState update(TokenList.Iterator copyCursor) { 59 if (copyCursor.atEnd()) return STUTTER; 60 61 _combineCurrentAndNextIfFind("/", "*", copyCursor); 62 _combineCurrentAndNextIfFind("/", "/", copyCursor); 63 _combineCurrentAndNextIfFind("","", copyCursor); 64 _combineCurrentAndNextIfFind("/","/*",copyCursor); 66 _combineCurrentAndNextIfFind("/","//",copyCursor); 67 _combineCurrentAndNextIfEscape(copyCursor); 68 69 String type = copyCursor.current().getType(); 70 if (type.equals("*/")) { 71 copyCursor._splitCurrentIfCommentBlock(true,false); 72 copyCursor.prev(); 73 return STUTTER; 74 } 75 else if (type.equals("//")) { 76 copyCursor.current().setState(FREE); 78 copyCursor.next(); 79 return INSIDE_LINE_COMMENT; 80 } 81 else if (type.equals("/*")) { 82 copyCursor.current().setState(FREE); 84 copyCursor.next(); 85 return INSIDE_BLOCK_COMMENT; 86 } 87 else if (type.equals("\'")) { 88 if (copyCursor.current().isClosed()) { 90 copyCursor.current().flip(); 91 } 92 copyCursor.current().setState(FREE); 93 copyCursor.next(); 94 return INSIDE_SINGLE_QUOTE; 95 } 96 else if (type.equals("\"")) { 97 if (copyCursor.current().isClosed()) { 99 copyCursor.current().flip(); 100 } 101 copyCursor.current().setState(FREE); 102 copyCursor.next(); 103 return INSIDE_DOUBLE_QUOTE; 104 } 105 else { 106 copyCursor.current().setState(FREE); 107 copyCursor.next(); 108 return FREE; 109 } 110 } 111 } 112 | Popular Tags |