From 73dd3f241192cb676716446bbc364d437eee2012 Mon Sep 17 00:00:00 2001 From: Netshroud Date: Fri, 14 Dec 2012 12:33:00 +1100 Subject: [PATCH] Reverted auto reformatting of method calls --HG-- extra : amend_source : e039aba851248dffbd8b19093fcd46ac3f61bd1f --- .../SteamLanguageParser/CodeGenerator.cs | 6 ++-- .../SteamLanguageParser/Generator/JavaGen.cs | 10 +++--- .../Generator/ObjCGenBase.cs | 2 +- .../Parser/LanguageParser.cs | 16 ++++----- .../Parser/SymbolLocator.cs | 4 +-- .../Parser/TokenAnalyzer.cs | 12 +++---- Resources/SteamLanguageParser/Program.cs | 36 +++++++++---------- 7 files changed, 43 insertions(+), 43 deletions(-) diff --git a/Resources/SteamLanguageParser/CodeGenerator.cs b/Resources/SteamLanguageParser/CodeGenerator.cs index a44afb6b..78561a43 100644 --- a/Resources/SteamLanguageParser/CodeGenerator.cs +++ b/Resources/SteamLanguageParser/CodeGenerator.cs @@ -120,7 +120,7 @@ namespace SteamLanguageParser return 0; } - public static void EmitCode(Node root, ICodeGen gen, StringBuilder sb, string nspace, bool supportsGC, bool internalFile) + public static void EmitCode(Node root, ICodeGen gen, StringBuilder sb, string nspace, bool supportsGC, bool internalFile ) { gen.EmitNamespace(sb, false, nspace); @@ -128,8 +128,8 @@ namespace SteamLanguageParser if (gen.SupportsNamespace()) level = 1; - if (internalFile) - gen.EmitSerialBase(sb, level, supportsGC); + if ( internalFile ) + gen.EmitSerialBase( sb, level, supportsGC ); foreach (Node n in root.childNodes) { diff --git a/Resources/SteamLanguageParser/Generator/JavaGen.cs b/Resources/SteamLanguageParser/Generator/JavaGen.cs index eb5dda51..ad947fc9 100644 --- a/Resources/SteamLanguageParser/Generator/JavaGen.cs +++ b/Resources/SteamLanguageParser/Generator/JavaGen.cs @@ -127,7 +127,7 @@ namespace SteamLanguageParser sb.AppendLine(padding + "\tpublic int getCode() {"); sb.AppendLine(padding + "\t\treturn code;"); sb.AppendLine(padding + "\t}"); - + sb.AppendLine(padding + "\tpublic static " + enode.Name + " lookup( int code ) {"); sb.AppendLine(padding + "\t\tfor ( " + enode.Name + " x : values() ) {"); sb.AppendLine(padding + "\t\t\tif( x.getCode() == code ) return x;"); @@ -221,7 +221,7 @@ namespace SteamLanguageParser int size = CodeGenerator.GetTypeSize(prop); baseClassSize += size; - sb.AppendLine(padding + "// Static size: " + size); + sb.AppendLine( padding + "// Static size: " + size); int temp; if (!String.IsNullOrEmpty(prop.FlagsOpt) && Int32.TryParse(prop.FlagsOpt, out temp)) @@ -285,7 +285,7 @@ namespace SteamLanguageParser { ctor = "(byte)" + ctor; } - + if (defflags != null && defflags == "steamidmarshal") { symname = prop.Name; @@ -352,7 +352,7 @@ namespace SteamLanguageParser sb.AppendLine(padding + "\tByteBuffer buf" + GetUpperName(prop.Name) + " = " + GetUpperName(prop.Name) + ".serialize();"); } - varLengthProps.Add("buf" + GetUpperName(prop.Name) + ".limit()"); + varLengthProps.Add( "buf" + GetUpperName(prop.Name) + ".limit()" ); } } @@ -384,7 +384,7 @@ namespace SteamLanguageParser propName = propName + ".getCode()"; } - + if (!readerTypeMap.ContainsKey(typestr)) { typestr = CodeGenerator.GetTypeOfSize(size, SupportsUnsignedTypes()); diff --git a/Resources/SteamLanguageParser/Generator/ObjCGenBase.cs b/Resources/SteamLanguageParser/Generator/ObjCGenBase.cs index 92ba81f9..21f6a6de 100644 --- a/Resources/SteamLanguageParser/Generator/ObjCGenBase.cs +++ b/Resources/SteamLanguageParser/Generator/ObjCGenBase.cs @@ -50,7 +50,7 @@ namespace SteamLanguageParser { } } - public virtual string EmitType(Symbol sym + public virtual string EmitType(Symbol sym) { if (sym is WeakSymbol) { diff --git a/Resources/SteamLanguageParser/Parser/LanguageParser.cs b/Resources/SteamLanguageParser/Parser/LanguageParser.cs index 92c89c5e..c3a4b0e5 100644 --- a/Resources/SteamLanguageParser/Parser/LanguageParser.cs +++ b/Resources/SteamLanguageParser/Parser/LanguageParser.cs @@ -24,10 +24,10 @@ namespace SteamLanguageParser @"(?\s+)|" + @"(?[;])|" + - "[\"](?.+?)[\"]|" + + "[\"](?.+?)[\"]|" + @"(?-?[a-zA-Z_0-9][a-zA-Z0-9_:.]*)|" + - @"[#](?[a-zA-Z]*)|" + + @"[#](?[a-zA-Z]*)|" + @"(?[{}<>\]=])|" + @"(?[^\s]+)"; @@ -36,21 +36,21 @@ namespace SteamLanguageParser public static Queue TokenizeString(string buffer) { - MatchCollection matches = regexPattern.Matches(buffer); + MatchCollection matches = regexPattern.Matches( buffer ); Queue tokenList = new Queue(); - foreach (Match match in matches) + foreach ( Match match in matches ) { int i = 0; - foreach (Group group in match.Groups) + foreach ( Group group in match.Groups ) { string matchValue = group.Value; bool success = group.Success; - if (success && i > 1) + if ( success && i > 1 ) { - string groupName = regexPattern.GroupNameFromNumber(i); - tokenList.Enqueue(new Token(groupName, matchValue)); + string groupName = regexPattern.GroupNameFromNumber( i ); + tokenList.Enqueue( new Token( groupName, matchValue ) ); } i++; } diff --git a/Resources/SteamLanguageParser/Parser/SymbolLocator.cs b/Resources/SteamLanguageParser/Parser/SymbolLocator.cs index 43f62749..6d37187a 100644 --- a/Resources/SteamLanguageParser/Parser/SymbolLocator.cs +++ b/Resources/SteamLanguageParser/Parser/SymbolLocator.cs @@ -116,9 +116,9 @@ namespace SteamLanguageParser return new StrongSymbol(classNode, propNode); } - + throw new Exception("Invalid symbol"); } - + } } diff --git a/Resources/SteamLanguageParser/Parser/TokenAnalyzer.cs b/Resources/SteamLanguageParser/Parser/TokenAnalyzer.cs index da4480eb..99e8afa6 100644 --- a/Resources/SteamLanguageParser/Parser/TokenAnalyzer.cs +++ b/Resources/SteamLanguageParser/Parser/TokenAnalyzer.cs @@ -39,7 +39,7 @@ namespace SteamLanguageParser class TokenAnalyzer { - public static Node Analyze(Queue tokens) + public static Node Analyze( Queue tokens ) { Node root = new Node(); @@ -56,9 +56,9 @@ namespace SteamLanguageParser if (cur.Value == "import") { - Queue parentTokens = LanguageParser.TokenizeString(File.ReadAllText(text.Value)); + Queue parentTokens = LanguageParser.TokenizeString( File.ReadAllText( text.Value ) ); - Node newRoot = Analyze(parentTokens); + Node newRoot = Analyze( parentTokens ); foreach (Node child in newRoot.childNodes) { @@ -116,12 +116,12 @@ namespace SteamLanguageParser Token op2 = Expect(tokens, "operator", ">"); } - Token flag = Optional(tokens, "identifier"); + Token flag = Optional( tokens, "identifier" ); EnumNode enode = new EnumNode(); enode.Name = name.Value; - if (flag != null) + if ( flag != null ) { enode.Flags = flag.Value; } @@ -210,7 +210,7 @@ namespace SteamLanguageParser return new Token("EOF", ""); } - if (peek.Name != name) + if(peek.Name != name) { throw new Exception("Expecting " + name); } diff --git a/Resources/SteamLanguageParser/Program.cs b/Resources/SteamLanguageParser/Program.cs index 391cb138..f86ebc07 100644 --- a/Resources/SteamLanguageParser/Program.cs +++ b/Resources/SteamLanguageParser/Program.cs @@ -9,51 +9,51 @@ namespace SteamLanguageParser { class Program { - static void Main(string[] args) + static void Main( string[] args ) { - string projectPath = Environment.GetEnvironmentVariable("SteamRE") ?? args.SingleOrDefault(); + string projectPath = Environment.GetEnvironmentVariable( "SteamRE" ) ?? args.SingleOrDefault(); - if (!Directory.Exists(projectPath)) + if ( !Directory.Exists( projectPath )) { - throw new Exception("Unable to find SteamRE project path, please specify the `SteamRE` environment variable"); + throw new Exception( "Unable to find SteamRE project path, please specify the `SteamRE` environment variable" ); } - ParseFile(projectPath, @"Resources\SteamLanguage", "steammsg.steamd", "SteamKit2", @"SteamKit2\SteamKit2\Base\Generated\", "SteamLanguage", true, new CSharpGen(), "cs"); + ParseFile( projectPath, @"Resources\SteamLanguage", "steammsg.steamd", "SteamKit2", @"SteamKit2\SteamKit2\Base\Generated\", "SteamLanguage", true, new CSharpGen(), "cs" ); - //ParseFile(projectPath, @"Resources\SteamLanguage", "steammsg.steamd", "SteamKit2", @"SteamKit2\ObjC\", "SteamLanguage", true, new ObjCInterfaceGen(), "h"); - //ParseFile(projectPath, @"Resources\SteamLanguage", "steammsg.steamd", "SteamKit2", @"SteamKit2\ObjC\", "SteamLanguage", true, new ObjCImplementationGen(), "m"); + //ParseFile( projectPath, @"Resources\SteamLanguage", "steammsg.steamd", "SteamKit2", @"SteamKit2\ObjC\", "SteamLanguage", true, new ObjCInterfaceGen(), "h" ); + //ParseFile( projectPath, @"Resources\SteamLanguage", "steammsg.steamd", "SteamKit2", @"SteamKit2\ObjC\", "SteamLanguage", true, new ObjCImplementationGen(), "m" ); } private static void ParseFile(string projectPath, string path, string file, string nspace, string outputPath, string outFile, bool supportsGC, ICodeGen codeGen, string fileNameSuffix) { - string languagePath = Path.Combine(projectPath, path); + string languagePath = Path.Combine( projectPath, path ); Environment.CurrentDirectory = languagePath; - Queue tokenList = LanguageParser.TokenizeString(File.ReadAllText(Path.Combine(languagePath, file))); - - Node root = TokenAnalyzer.Analyze(tokenList); + Queue tokenList = LanguageParser.TokenizeString( File.ReadAllText( Path.Combine( languagePath, file ) ) ); + Node root = TokenAnalyzer.Analyze( tokenList ); + Node rootEnumNode = new Node(); Node rootMessageNode = new Node(); // this is now heavily c# based code // anyone looking to modify JavaGen or crate a different generator has their work cut out for them - rootEnumNode.childNodes.AddRange(root.childNodes.Where(n => n is EnumNode)); - rootMessageNode.childNodes.AddRange(root.childNodes.Where(n => n is ClassNode)); + rootEnumNode.childNodes.AddRange( root.childNodes.Where( n => n is EnumNode ) ); + rootMessageNode.childNodes.AddRange( root.childNodes.Where( n => n is ClassNode ) ); StringBuilder enumBuilder = new StringBuilder(); StringBuilder messageBuilder = new StringBuilder(); - CodeGenerator.EmitCode(rootEnumNode, codeGen, enumBuilder, nspace, supportsGC, false); + CodeGenerator.EmitCode( rootEnumNode, codeGen, enumBuilder, nspace, supportsGC, false ); CodeGenerator.EmitCode(rootMessageNode, codeGen, messageBuilder, nspace + ".Internal", supportsGC, true); - string outputEnumFile = Path.Combine(outputPath, outFile + "." + fileNameSuffix); - string outputMessageFile = Path.Combine(outputPath, outFile + "Internal." + fileNameSuffix); + string outputEnumFile = Path.Combine( outputPath, outFile + "." + fileNameSuffix ); + string outputMessageFile = Path.Combine( outputPath, outFile + "Internal." + fileNameSuffix ); - File.WriteAllText(Path.Combine(projectPath, outputEnumFile), enumBuilder.ToString()); - File.WriteAllText(Path.Combine(projectPath, outputMessageFile), messageBuilder.ToString()); + File.WriteAllText( Path.Combine( projectPath, outputEnumFile ), enumBuilder.ToString() ); + File.WriteAllText( Path.Combine( projectPath, outputMessageFile ), messageBuilder.ToString() ); } } }