Class IndexFileParser
java.lang.Object
org.checkerframework.afu.scenelib.io.IndexFileParser
IndexFileParser provides static methods
parse(LineNumberReader, String, AScene)
, parseFile(String, AScene)
, and parseString(String, String, AScene)
. Each of these
parses an index file into a AScene
.
If there are any problems, it throws a ParseException internally, or a FileIOException externally.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addDef
(AnnotationDef ad) void
addDef
(AnnotationDef ad, String basename) static Map
<String, AnnotationDef> parse
(LineNumberReader in, String filename, AScene scene) Reads annotations fromin
in index file format and merges them intoscene
.static Map
<String, AnnotationDef> Reads annotations from the index filefilename
and merges them intoscene
; seeparse(LineNumberReader, String, AScene)
.static Map
<String, AnnotationDef> parseString
(String fileContents, String source, AScene scene) Reads annotations from the string (in index file format) and merges them intoscene
; seeparse(LineNumberReader, String, AScene)
.static Type
Parse the given text into aType
.static void
setAbbreviate
(boolean b)
-
Method Details
-
setAbbreviate
public static void setAbbreviate(boolean b) -
addDef
- Throws:
ParseException
-
addDef
- Throws:
ParseException
-
parse
public static Map<String,AnnotationDef> parse(LineNumberReader in, String filename, AScene scene) throws IOException, ParseException Reads annotations fromin
in index file format and merges them intoscene
. Annotations from the input are merged into the scene; it is an error if both the scene and the input contain annotations of the same type on the same element.Since each annotation in a scene carries its own definition and the scene as a whole no longer has a set of definitions, annotation definitions that are given in the input but never used are not saved anywhere and will not be included if the scene is written back to an index file. Similarly, retention policies on definitions of annotations that are never used at the top level are dropped.
Caveat: Parsing of floating point numbers currently does not work.
- Throws:
IOException
ParseException
-
parseFile
Reads annotations from the index filefilename
and merges them intoscene
; seeparse(LineNumberReader, String, AScene)
.- Throws:
IOException
-
parseString
public static Map<String,AnnotationDef> parseString(String fileContents, String source, AScene scene) throws IOException Reads annotations from the string (in index file format) and merges them intoscene
; seeparse(LineNumberReader, String, AScene)
. Primarily for testing.- Throws:
IOException
-
parseType
Parse the given text into aType
.- Parameters:
text
- the text to parse- Returns:
- the type
-