Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: make generator quoting methods public #7392

Merged
merged 5 commits into from
Aug 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions core/generator.ts
Original file line number Diff line number Diff line change
@@ -170,10 +170,6 @@ export class CodeGenerator {
return codeString;
}

// The following are some helpful functions which can be used by multiple

// languages.

/**
* Prepend a common prefix onto each line of code.
* Intended for indenting code or adding comment markers.
2 changes: 0 additions & 2 deletions generators/dart/dart_generator.js
Original file line number Diff line number Diff line change
@@ -176,7 +176,6 @@ export class DartGenerator extends CodeGenerator {
* Encode a string as a properly escaped Dart string, complete with quotes.
* @param {string} string Text to encode.
* @return {string} Dart string.
* @protected
*/
quote_(string) {
// Can't use goog.string.quote since $ must also be escaped.
@@ -192,7 +191,6 @@ export class DartGenerator extends CodeGenerator {
* quotes.
* @param {string} string Text to encode.
* @return {string} Dart string.
* @protected
*/
multiline_quote_(string) {
const lines = string.split(/\n/g).map(this.quote_);
2 changes: 0 additions & 2 deletions generators/javascript/javascript_generator.js
Original file line number Diff line number Diff line change
@@ -206,7 +206,6 @@ export class JavascriptGenerator extends CodeGenerator {
* quotes.
* @param {string} string Text to encode.
* @return {string} JavaScript string.
* @protected
*/
quote_(string) {
// Can't use goog.string.quote since Google's style guide recommends
@@ -222,7 +221,6 @@ export class JavascriptGenerator extends CodeGenerator {
* with quotes.
* @param {string} string Text to encode.
* @return {string} JavaScript string.
* @protected
*/
multiline_quote_(string) {
// Can't use goog.string.quote since Google's style guide recommends
2 changes: 0 additions & 2 deletions generators/lua/lua_generator.js
Original file line number Diff line number Diff line change
@@ -149,7 +149,6 @@ export class LuaGenerator extends CodeGenerator {
* quotes.
* @param {string} string Text to encode.
* @return {string} Lua string.
* @protected
*/
quote_(string) {
string = string.replace(/\\/g, '\\\\')
@@ -163,7 +162,6 @@ export class LuaGenerator extends CodeGenerator {
* quotes.
* @param {string} string Text to encode.
* @return {string} Lua string.
* @protected
*/
multiline_quote_(string) {
const lines = string.split(/\n/g).map(this.quote_);
2 changes: 0 additions & 2 deletions generators/php/php_generator.js
Original file line number Diff line number Diff line change
@@ -184,7 +184,6 @@ export class PhpGenerator extends CodeGenerator {
* quotes.
* @param {string} string Text to encode.
* @return {string} PHP string.
* @protected
*/
quote_(string) {
string = string.replace(/\\/g, '\\\\')
@@ -198,7 +197,6 @@ export class PhpGenerator extends CodeGenerator {
* quotes.
* @param {string} string Text to encode.
* @return {string} PHP string.
* @protected
*/
multiline_quote_(string) {
const lines = string.split(/\n/g).map(this.quote_);
2 changes: 0 additions & 2 deletions generators/python/python_generator.js
Original file line number Diff line number Diff line change
@@ -228,7 +228,6 @@ export class PythonGenerator extends CodeGenerator {
* Encode a string as a properly escaped Python string, complete with quotes.
* @param {string} string Text to encode.
* @return {string} Python string.
* @protected
*/
quote_(string) {
string = string.replace(/\\/g, '\\\\').replace(/\n/g, '\\\n');
@@ -250,7 +249,6 @@ export class PythonGenerator extends CodeGenerator {
* with quotes.
* @param {string} string Text to encode.
* @return {string} Python string.
* @protected
*/
multiline_quote_(string) {
const lines = string.split(/\n/g).map(this.quote_);