summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorGravatar akashlal <unknown>2010-08-12 10:37:34 +0000
committerGravatar akashlal <unknown>2010-08-12 10:37:34 +0000
commit3895897f97d2234533a23f0e99e95af73e8f0734 (patch)
treed2d08769be2ad28e8e3a2cf13a440e769b15473f /Source/Core
parent76293306ad695ffd7a9150ad947e731a0f3217ee (diff)
Added methods to read a file from any Stream object
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Parser.ssc5
-rw-r--r--Source/Core/ParserHelper.ssc4
2 files changed, 7 insertions, 2 deletions
diff --git a/Source/Core/Parser.ssc b/Source/Core/Parser.ssc
index 68148acf..86f792bb 100644
--- a/Source/Core/Parser.ssc
+++ b/Source/Core/Parser.ssc
@@ -57,6 +57,11 @@ public static int Parse (string! filename, /*maybe null*/ List<string!> defines,
FileStream stream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read);
+ return Parse(stream, filename, defines, out program);
+}
+
+// Read the program from a stream. This allows the program to be stored in memory.
+public static int Parse (Stream! stream, string! filename, /*maybe null*/ List<string!> defines, out /*maybe null*/ Program program) /* throws System.IO.IOException */ {
if (defines == null) {
defines = new List<string!>();
diff --git a/Source/Core/ParserHelper.ssc b/Source/Core/ParserHelper.ssc
index 8b0d3fed..67cd261a 100644
--- a/Source/Core/ParserHelper.ssc
+++ b/Source/Core/ParserHelper.ssc
@@ -93,8 +93,8 @@ public static class ParserHelper {
return defines.Contains(arg) == sense;
}
- public static string! Fill(FileStream! fileStream, List<string!>! defines) {
- StreamReader! reader = new StreamReader(fileStream);
+ public static string! Fill(Stream! stream, List<string!>! defines) {
+ StreamReader! reader = new StreamReader(stream);
return Fill(reader, defines);
}
public static string! Fill(TextReader! reader, List<string!>! defines) {