+ if (prevLine.endsWith("\\"))
+ continue;
+ trimedLine = trimSpace(curLine);
+ if (!foundHead) {
+ if (trimedLine.startsWith("/**")) {
+ _beginLineNum = reader.getLineNumber();
+ _beginLine = curLine;
+ foundHead = true;
+ specText.append("\n");
+ specText.append(curLine);
+ if (trimedLine.endsWith("*/")) {
+ _endLineNum = reader.getLineNumber();
+ foundHead = false;
+ if (isComment(specText.toString()))
+ continue;
+ Construct inst = SpecParser.parseSpec(specText
+ .toString());
+ if (inst instanceof InterfaceConstruct) {
+ funcDecl = readFunctionDecl(reader);
+ specConstruct = new SpecConstruct(
+ specText.toString(), file,
+ _beginLineNum, _endLineNum, inst, funcDecl);
+ } else {
+ specConstruct = new SpecConstruct(
+ specText.toString(), file,
+ _beginLineNum, _endLineNum, inst);
+ }
+ specText = new StringBuilder();
+ System.out.println(specConstruct);
+ }
+ }
+ } else {
+ specText.append("\n");
+ specText.append(curLine);
+ if (trimedLine.endsWith("*/")) {
+ _endLineNum = reader.getLineNumber();
+ foundHead = false;
+ if (isComment(specText.toString())) {
+ specText = new StringBuilder();
+ continue;
+ }
+ Construct inst = SpecParser.parseSpec(specText
+ .toString());
+ if (inst instanceof InterfaceConstruct) {
+ funcDecl = readFunctionDecl(reader);
+ specConstruct = new SpecConstruct(
+ specText.toString(), file,
+ _beginLineNum, _endLineNum, inst, funcDecl);
+ } else {
+ specConstruct = new SpecConstruct(
+ specText.toString(), file,
+ _beginLineNum, _endLineNum, inst);
+ }
+ System.out.println(specConstruct);
+ specText = new StringBuilder();
+ }
+ }
+ }
+ // At the end we can only find the head "/**" but no tail found
+ if (foundHead) {
+ String msg = "In file \"" + file.getAbsolutePath()
+ + "\", line: " + _beginLineNum + "\n" + _beginLine
+ + "\n" + "Can't find matching spec.";
+ throw new SpecNotMatchException(msg);