diff --git a/lib/emit.js b/lib/emit.js index 7cb0f3a..9057ec2 100644 --- a/lib/emit.js +++ b/lib/emit.js @@ -50,6 +50,27 @@ GoEmitter.prototype.go_lint_capitalize = function(n) { n = n.replace(/pgp/g, "PGP"); n = n.replace(/Pgp/g, "PGP"); + n = n.replace(/^Tty/, 'TTY'); + n = n.replace(/^Tlfid/, 'TLFID'); + n = n.replace(/^Tlf/, 'TLF'); + n = n.replace(/^Uid/, 'UID'); + n = n.replace(/^Kid/, 'KID'); + n = n.replace(/^Cli/, 'CLI'); + n = n.replace(/^Api/, 'API'); + n = n.replace(/^Btc/, 'BTC'); + n = n.replace(/^Pgp/, 'PGP'); + n = n.replace(/^Gpg/, 'GPG'); + n = n.replace(/^Uri/, 'URI'); + n = n.replace(/^Gui/, 'GUI'); + n = n.replace(/^Kbfs/, 'KBFS'); + n = n.replace(/^Json/, 'JSON'); + n = n.replace(/Ed25519/, 'ED25519'); + n = n.replace(/^Id/, 'ID'); + n = n.replace(/^Kv/, 'KV'); + n = n.replace(/^Ui/, 'UI'); + n = n.replace(/^Fs/, 'FS'); + n = n.replace(/^Md/, 'MD'); + n = n.replace(/^Ok/, 'OK'); return n; }; diff --git a/lib/main.js b/lib/main.js index 4f27d3b..e9d99bd 100644 --- a/lib/main.js +++ b/lib/main.js @@ -1,4 +1,4 @@ -// Generated by IcedCoffeeScript 108.0.9 +// Generated by IcedCoffeeScript 108.0.11 (function() { var GoEmitter, Main, avdl2json, emit, fs, iced, make_esc, minimist, output, pathmod, usage, __iced_k, __iced_k_noop; @@ -41,7 +41,7 @@ return (function(__iced_k) { __iced_deferrals = new iced.Deferrals(__iced_k, { parent: ___iced_passed_deferral, - filename: "/Users/max/src/keybase/node-avdl-compiler/src/main.iced" + filename: "/home/songgao/gopath/src/github.com/keybase/node-avdl-compiler/src/main.iced" }); fs.writeFile(outfile, code.join("\n"), __iced_deferrals.defer({ assign_fn: (function() { @@ -106,7 +106,7 @@ return (function(__iced_k) { __iced_deferrals = new iced.Deferrals(__iced_k, { parent: ___iced_passed_deferral, - filename: "/Users/max/src/keybase/node-avdl-compiler/src/main.iced", + filename: "/home/songgao/gopath/src/github.com/keybase/node-avdl-compiler/src/main.iced", funcname: "Main.skip_infile" }); fs.stat(infile, esc(__iced_deferrals.defer({ @@ -147,7 +147,7 @@ (function(__iced_k) { __iced_deferrals = new iced.Deferrals(__iced_k, { parent: ___iced_passed_deferral, - filename: "/Users/max/src/keybase/node-avdl-compiler/src/main.iced", + filename: "/home/songgao/gopath/src/github.com/keybase/node-avdl-compiler/src/main.iced", funcname: "Main.do_file" }); fs.unlink(outfile, __iced_deferrals.defer({ @@ -166,7 +166,7 @@ (function(__iced_k) { __iced_deferrals = new iced.Deferrals(__iced_k, { parent: ___iced_passed_deferral, - filename: "/Users/max/src/keybase/node-avdl-compiler/src/main.iced", + filename: "/home/songgao/gopath/src/github.com/keybase/node-avdl-compiler/src/main.iced", funcname: "Main.do_file" }); avdl2json.parse({ @@ -185,7 +185,7 @@ (function(__iced_k) { __iced_deferrals = new iced.Deferrals(__iced_k, { parent: ___iced_passed_deferral, - filename: "/Users/max/src/keybase/node-avdl-compiler/src/main.iced", + filename: "/home/songgao/gopath/src/github.com/keybase/node-avdl-compiler/src/main.iced", funcname: "Main.do_file" }); emit({ @@ -204,7 +204,7 @@ (function(__iced_k) { __iced_deferrals = new iced.Deferrals(__iced_k, { parent: ___iced_passed_deferral, - filename: "/Users/max/src/keybase/node-avdl-compiler/src/main.iced", + filename: "/home/songgao/gopath/src/github.com/keybase/node-avdl-compiler/src/main.iced", funcname: "Main.do_file" }); output({ @@ -260,7 +260,7 @@ (function(__iced_k) { __iced_deferrals = new iced.Deferrals(__iced_k, { parent: ___iced_passed_deferral, - filename: "/Users/max/src/keybase/node-avdl-compiler/src/main.iced", + filename: "/home/songgao/gopath/src/github.com/keybase/node-avdl-compiler/src/main.iced", funcname: "Main.do_batch_mode" }); _this.skip_infile({ @@ -285,7 +285,7 @@ (function(__iced_k) { __iced_deferrals = new iced.Deferrals(__iced_k, { parent: ___iced_passed_deferral, - filename: "/Users/max/src/keybase/node-avdl-compiler/src/main.iced", + filename: "/home/songgao/gopath/src/github.com/keybase/node-avdl-compiler/src/main.iced", funcname: "Main.do_batch_mode" }); _this.do_file({ @@ -322,7 +322,7 @@ return (function(__iced_k) { __iced_deferrals = new iced.Deferrals(__iced_k, { parent: ___iced_passed_deferral, - filename: "/Users/max/src/keybase/node-avdl-compiler/src/main.iced", + filename: "/home/songgao/gopath/src/github.com/keybase/node-avdl-compiler/src/main.iced", funcname: "Main.main" }); _this.parse_argv({ @@ -339,7 +339,7 @@ (function(__iced_k) { __iced_deferrals = new iced.Deferrals(__iced_k, { parent: ___iced_passed_deferral, - filename: "/Users/max/src/keybase/node-avdl-compiler/src/main.iced", + filename: "/home/songgao/gopath/src/github.com/keybase/node-avdl-compiler/src/main.iced", funcname: "Main.main" }); _this.do_batch_mode({}, esc(__iced_deferrals.defer({ @@ -351,7 +351,7 @@ (function(__iced_k) { __iced_deferrals = new iced.Deferrals(__iced_k, { parent: ___iced_passed_deferral, - filename: "/Users/max/src/keybase/node-avdl-compiler/src/main.iced", + filename: "/home/songgao/gopath/src/github.com/keybase/node-avdl-compiler/src/main.iced", funcname: "Main.main" }); _this.do_file({ @@ -383,7 +383,7 @@ return (function(__iced_k) { __iced_deferrals = new iced.Deferrals(__iced_k, { parent: ___iced_passed_deferral, - filename: "/Users/max/src/keybase/node-avdl-compiler/src/main.iced", + filename: "/home/songgao/gopath/src/github.com/keybase/node-avdl-compiler/src/main.iced", funcname: "main" }); main.main({ diff --git a/src/emit.iced b/src/emit.iced index 233b759..81caa60 100644 --- a/src/emit.iced +++ b/src/emit.iced @@ -32,6 +32,31 @@ exports.GoEmitter = class GoEmitter go_lint_capitalize : (n) -> n = n.replace /pgp/g, "PGP" n = n.replace /Pgp/g, "PGP" + n = n.replace /^Tty/, 'TTY' + n = n.replace /^Tlfid/, 'TLFID' + n = n.replace /^Tlf/, 'TLF' + n = n.replace /^Uid/, 'UID' + n = n.replace /^Kid/, 'KID' + n = n.replace /^Cli/, 'CLI' + n = n.replace /^Api/, 'API' + n = n.replace /^Btc/, 'BTC' + n = n.replace /^Pgp/, 'PGP' + n = n.replace /^Gpg/, 'GPG' + n = n.replace /^Uri/, 'URI' + n = n.replace /^Gui/, 'GUI' + + n = n.replace /^Kbfs/, 'KBFS' + n = n.replace /^Json/, 'JSON' + + n = n.replace /Ed25519/, 'ED25519' + + n = n.replace /^Id/, 'ID' + n = n.replace /^Kv/, 'KV' + n = n.replace /^Ui/, 'UI' + n = n.replace /^Fs/, 'FS' + n = n.replace /^Md/, 'MD' + n = n.replace /^Ok/, 'OK' + n go_package : (n) -> n.replace(/[.-]/g, "") diff --git a/test/avdl/sample.avdl b/test/avdl/sample.avdl index 3684378..5f68541 100644 --- a/test/avdl/sample.avdl +++ b/test/avdl/sample.avdl @@ -18,6 +18,11 @@ protocol sample { keybase1.UID bar; } + record Ha { + string tlfMessage; + string tlfid; + } + /** GetBaz will get a baz like you wouldn't believe. If this baz isn't gotten, then I'll eat my hat diff --git a/test/files/sample.go-nocompile b/test/files/sample.go-nocompile index 5d777db..949aa14 100644 --- a/test/files/sample.go-nocompile +++ b/test/files/sample.go-nocompile @@ -1,10 +1,10 @@ -// Auto-generated by avdl-compiler v1.3.7 (https://github.com/keybase/node-avdl-compiler) -// Input file: /Users/max/src/keybase/node-avdl-compiler/test/files/../avdl/sample.avdl +// Auto-generated by avdl-compiler v1.3.9 (https://github.com/keybase/node-avdl-compiler) +// Input file: /home/songgao/gopath/src/github.com/keybase/node-avdl-compiler/test/files/../avdl/sample.avdl package sample1 import ( - rpc "github.com/keybase/go-framed-msgpack-rpc" + "github.com/keybase/go-framed-msgpack-rpc/rpc" context "golang.org/x/net/context" keybase1 "github.com/keybase/client/go/protocol/keybase1" "errors" @@ -18,6 +18,11 @@ type R struct { Bar keybase1.UID `codec:"bar" json:"bar"` } +type Ha struct { + TLFMessage string `codec:"tlfMessage" json:"tlfMessage"` + TLFID string `codec:"tlfid" json:"tlfid"` +} + type Types int const ( Types_NONE Types = 0