Example:
Variable string = "ria4 ";
Bullet (string );
// The code above callback is Cantonese JavaScript, and the wide type is "wide JavaScript". After being [translated], the following JavaScript native code is obtained:
VaR string = "ria4 ";
Alert (string );
The original mission of broad language is to convert the keywords of various languages into Chinese, and then create a Chinese function library corresponding to various object methods. Although there are more targets, the keyword is localized, in particular, using a Chinese character to correspond to a keyword is the most sacred process of a wide language. The following function is to [translate] JavaScript, that is, to restore a wide-Language Writing Method to the original format of the language (not cute at all ). The simplest example is to change "if" to "if" and change "function" to "function ".
The content of the Code will be explained later. In the future, it will also use a text-style database to implement these control relationships. As a "alias", the natural language will first be replaced with a simple broad style, then participate in [Broad translation ]. (In the future, the content enclosed by the "[]" symbol is a function in a wide range of languages ).
The following is a broad message:
Function wide translation (parameter ){
/*
■ JavaScript keywords
For example, if
Another else. Otherwise
Switch switch to determine
Case, Case, Case
Default default
Continue with continue
Break the break and jump out of the loop
For.
Do things, please
Although While
In in
Variable VAR
Function
Return return
Try again
Catch
Stubborn finally tenacious and wrong
Throw
New
Delete Delete
This is this, this is
Type of mooring typeof query, parked
Wang instanceof this type, Wang
No void, no type
Same with associates
■ JavaScript keyword combination
If else if otherwise
*/
VaR result = parameter;
//
If = (if + "Wide separation" + "/^ (\ s *\\}?) For example,/GM "+" Wide separation "+" $ 1if ");
If = (if + "Wide separation" + "/^ (\ s *\\}?) \ S * Other/GM "+" Wide separation "+" $1 else ");
If = (if + "Wide separation" + "/^ (\ s *\\}?) Gate/GM "+" Wide separation "+" $1 switch ");
If = (if + "Wide separation" + "/^ (\ s *\\}?) Case/GM "+" Wide separation "+" $1 case ");
If = (if + "Wide separation" + "/^ (\ s *\\}?) Mo/GM "+" Wide separation "+" $1 default ")
If = (if + "Wide separation" + "/^ (\ s *\\}?) Followed by/GM "+" Wide separation "+" $1 continue ");
If = (if + "Wide separation" + "/^ (\ s *\\}?) Escape/GM "+" Wide separation "+" $1 break ")
If = (if + "Wide separation" + "/^ (\ s *\\}?) For/GM "+" Wide separation "+" $ 1for ");
If = (if + "Wide separation" + "/^ (\ s *\\}?) Do/GM "+" Wide separation "+" $ 1do ");
If = (if + "Wide separation" + "/^ (\ s *\\}?) Although/GM "+" Wide separation "+" $1 while ");
If = (if + "Wide separation" + "/^ (\ s *\\}?) In/GM "+" Wide separation "+" $ 1In ");
If = (if + "Wide separation" + "/^ (\ s *\\}?) Change/GM "+" Wide separation "+" $ 1var ");
If = (if + "Wide separation" + "/^ (\ s *\\}?) Letter/GM "+" Wide separation "+" $1 function ");
If = (if + "Wide separation" + "/^ (\ s *\\}?) Return/GM "+" Wide separation "+" $1 return ");
If = (if + "Wide separation" + "/^ (\ s *\\}?) Try/GM "+" Wide separation "+" $ 1try ");
If = (if + "Wide separation" + "/^ (\ s *\\}?) \ S * capture/GM "+" Wide separation "+" $1 catch ");
If = (if + "Wide separation" + "/^ (\ s *\\}?) Stubborn/GM "+" Wide separation "+" $1 finally ");
If = (if + "Wide separation" + "/^ (\ s *\\}?) Throw/GM "+" Wide separation "+" $1 throw ");
If = (if + "Wide separation" + "/= (\ s *\\}?) New/GM "+" Wide separation "+" = new ");
If = (if + "Wide separation" + "/^ (\ s *\\}?) Delete/GM "+" Wide separation "+" $1 Delete ");
If = (if + "Wide separation" + "/^ (\ s *\\}?) This/GM "+" Wide separation "+" $1 This ");
If = (if + "Wide separation" + "/^ (\ s *\\}?) Boat/GM "+" Wide separation "+" $1 typeof ");
If = (if + "Wide separation" + "/^ (\ s *\\}?) Wang/GM "+" Wide separation "+" $1 instanceof ");
If = (if + "Wide separation" + "/^ (\ s *\\}?) None/GM "+" Wide separation "+" $1 void ");
If = (if + "Wide separation" + "/^ (\ s *\\}?) Same/GM "+" Wide separation "+" $1 ");
If = (if + "Wide separation" + "/^ (\ s *\\}?) If/GM "+" Wide separation "+" $1 else if ");
//
Fruit = change (fruit + "Wide separation" + "/true/GM" + "Wide separation" + "true ");
Fruit = change (fruit + "Wide separation" + "/false/GM" + "Wide separation" + "false ");
//
Fruit = change (fruit + "wide separator" + "/string \ s * \ (/GM" + "wide separator" + "string ");
// If = (if + "Wide separation" + "/^ \ s *\\}? \ S * \ (/GM "+" Wide separation "+" alert (");
If = (if + "Wide separation" + "/^ \ s * example \ s * (. + ?);? \ S * $/GM "+" Wide separation "+" $ (\ "# fruit \" ).html ($1 );");
// Play ("broad translation:" + fruit );
Return result;
}
///////////////////////////////////////
Function Change (parameter ){
VaR result = parameter 2 (parameter); // regular text
VaR niyi = Execution (fruit) // regular object
Result = parameter 1 (parameter). Replace (niyi, parameter 3 (parameter ));
// Play ("[change] fruit:" + fruit );
Return result. tostring ();
}
///////////////////////////////////////
Function parameter 1 (parameter ){
VaR fruit = "";
Array parameter = cut (parameter );
Result = array parameter [0];
Return result;
}
Function parameter 2 (parameter ){
VaR fruit = "";
Array parameter = cut (parameter );
Result = array parameter [1];
Return result;
}
Function parameter 3 (parameter ){
VaR fruit = "";
Array parameter = cut (parameter );
Result = array parameter [2];
Return result;
}
//... (Other parameters are similar)
///////////////////////////////////////
Function execution (parameter ){
VaR fruit = "";
Try {
Result = eval (parameter + ";");
Return result;
} Catch (e ){
// Return without fruit + parameter + "error code:" + E;
}
}
///////////////////////////////////////
Function cut (parameter ){
Var = parameter. indexof ("Wide separation ");
VaR is separated by a wide range = (a few! =-1 );
VaR is a comma = parameter. indexof (",")! =-1;
VaR string = "";
If (with wide separation ){
String = "wide separator ";
} Else {
If (with commas ){
String = ","; // 441,891
} Else {
String = ",";
}
}
Array parameter = parameter. Split (string );
VaR result = array parameter;
Guang Guo = Guo;
Return result;
}