CN106126227B - A method of it realizes write code across human language on computers - Google Patents

A method of it realizes write code across human language on computers Download PDF

Info

Publication number
CN106126227B
CN106126227B CN201610460121.3A CN201610460121A CN106126227B CN 106126227 B CN106126227 B CN 106126227B CN 201610460121 A CN201610460121 A CN 201610460121A CN 106126227 B CN106126227 B CN 106126227B
Authority
CN
China
Prior art keywords
name
alias
handled
title
attribute
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610460121.3A
Other languages
Chinese (zh)
Other versions
CN106126227A (en
Inventor
周登祥
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhou Dengxiang
Original Assignee
Beijing Pu Hui Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Pu Hui Technology Co Ltd filed Critical Beijing Pu Hui Technology Co Ltd
Priority to CN201610460121.3A priority Critical patent/CN106126227B/en
Publication of CN106126227A publication Critical patent/CN106126227A/en
Application granted granted Critical
Publication of CN106126227B publication Critical patent/CN106126227B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/33Intelligent editors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/14Tree-structured documents

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Artificial Intelligence (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention belongs to computer engineering fields, and in particular to a method of it realizes write code across human language on computers.A method of it realizes write code across human language on computers, comprising the following steps: (1) the defined label of hypertext markup language is handled;(2) for the processing of cascading style sheets;(3) customized label of hypertext markup language is handled.

Description

A method of it realizes write code across human language on computers
Technical field
The invention belongs to computer engineering fields, and in particular to one kind is realized on computers writes code across human language Method.
Background technique
Currently the title of the label of hypertext markup language (HTML), attribute-name and some attribute values is English;Layer The title of selector (selector), attribute (property), value (value) and unit (units) in stacking style table (CSS) It is also English.For the people that many is unfamiliar with English, to write hypertext markup language and cascading style sheets generation Code, these English names have obstruction for them.
Summary of the invention
Goal of the invention: the present invention has made improvements in view of the above-mentioned problems of the prior art, i.e., the invention discloses one kind The method for writing code across human language is realized on computers.
Technical solution: a method of it realizes write code across human language on computers, comprising the following steps:
(1) the defined label of hypertext markup language is handled
(a1) label, the attribute for the hypertext markup language that setting browser needs to identify
The alias of name, attribute value title, establishes alias hash table;
(a2) when the bookmark name of browser resolves hypertext markup language, the alias that first query steps (a1) are established is hashed Table, if it is possible to find the bookmark name, then be handled with its corresponding original title, otherwise, just be located with the bookmark name Reason;
(a3) when the attribute-name title of browser resolves hypertext markup language, the alias that first query steps (a1) are established dissipates List, if it is possible to find the attribute-name title, then be handled with its corresponding original title, otherwise, just with the attribute-name name Claim to handle
(a4) when browser needs to compare the attribute value title of hypertext markup language, first query steps (a1) are established other Name hash table, if it is possible to find attribute value title, then be handled with its corresponding original value title, otherwise, just with the attribute Value title is handled;
(2) for the processing of cascading style sheets
(b1) setting browser need selector in the cascading style sheets that identifies, attribute, value, organization alias, Establish alias hash table;
(b2) browser resolves to cascading style sheets selector title when, query steps (b1) establish alias hash Table, if it is possible to find the selector, then be handled with its corresponding original title, otherwise, just be located with the selector title Reason;
(b3) browser resolves to cascading style sheets Property Name when, query steps (b1) establish alias hash table, If the Property Name can be found, handled with its corresponding original title, otherwise, is just handled with the Property Name;
(b4) when browser needs to compare the value of cascading style sheets, the alias hash table that query steps (b1) are established, if The value can be found, then is handled with its corresponding original value, otherwise, is just handled with the value;
(b5) when browser needs to compare the unit of cascading style sheets, the alias hash table that query steps (b1) are established, such as Fruit can find the organization, then handled with its corresponding original title, otherwise, just be handled with the organization;
(3) customized label of hypertext markup language is handled
(c1) alias of the bookmark name of customized label is set;
(c2) alias of the Property Name of customized label is set;
(c3) before registering customized label, the alias of customized target bookmark name and Property Name is set;
(c4) complete customized label registration after, setting the alias definition of the bookmark name of useful customized label mark Object is signed, the tag name of these label objects is revised as primitive name, and modify the Property Name of the label object, by attribute-name Title is changed to primitive name;
(c5) when creating customized label object, judge whether tag name and attribute-name are alias, if it is, modification mark Signature and the entitled primitive name of attribute.
The utility model has the advantages that one kind disclosed by the invention is realized on computers writes the method for code with following across human language The utility model has the advantages that
1, human language known to oneself can be used to write HTML/CSS code, and JavaScript also support across Human language programming, people can write application using language known to oneself, so that programming is popularized, In addition universal and handset capability the raising of mobile phone, people the human language known to oneself can be that computer is compiled on mobile phone Journey, programming become a kind of basic capacity.
2, since alias, a kind of customized label of human language exploitation can be set in the title of customized label and attribute It can be with another human language come using so that the internet component (Web Components) developed can be with different Human language uses.
Specific embodiment:
Detailed description of specific embodiments of the present invention below.
To be based on existing open source browser engine Chromium, https: //www.chromium.org/, version Illustrate for 49.0.2623.91.
A method of it realizes write code across human language on computers, comprising the following steps:
(1) the defined label of hypertext markup language is handled
(a1) label for the hypertext markup language that browser needs to identify, the alias of attribute-name, attribute value title are set, Establish alias hash table;
In third_party/WebKit/Source/core/Init.cpp file void CoreInitializer:: Alias hash table is established in init () method.
(a2) when the bookmark name of browser resolves hypertext markup language, the alias that first query steps (a1) are established is hashed Table, if it is possible to find the bookmark name, then be handled with its corresponding original title, otherwise, just be located with the bookmark name Reason;
(a3) when the attribute-name title of browser resolves hypertext markup language, the alias that first query steps (a1) are established dissipates List, if it is possible to find the attribute-name title, then be handled with its corresponding original title, otherwise, just with the attribute-name name Claim to handle;
The realization code of the processing of step a2 and step a3 is as follows: modification third_party/WebKit/Source/ core/html/parser/HTMLToken.h,third_party/WebKit/Source/core/html/parser/ HTMLTokenizer.cpp,third_party/WebKit/Source/core/html/parser/HTMLTokenizer.h; To support unicode tag name.Third_party/WebKit/Source/core/html/parser/HTMLToken.h's Modification :-void beginEndTag (LChar character)
+void beginEndTag(UChar character)
-void beginEndTag(const Vector<LChar,32>&characters)
+void beginEndTag(const Vector<UChar,32>&characters)
-void appendToCharacter(const Vector<LChar,32>&characters)
+void appendToCharacter(const Vector<UChar,32>&characters);
The modification of third_party/WebKit/Source/core/html/parser/HTMLTokenizer .cpp:
Modify bool HTMLTokenizer::nextToken (SegmentedString&source, HTMLToken& Token) method is modified in such a way, supports Unicode label.
-parseError();
-bufferCharacter('<');
-HTML_RECONSUME_IN(DataState);
+m_token->beginStartTag(cc);
+HTML_ADVANCE_TO(TagNameState);
Third_party/WebKit/Source/core/html/parser/HTMLViewSourc eParser.cpp's Modification:
Modify third_party/WebKit/Source/core/html/parser/CompactHTMLTo ken.cpp's Method CompactHTMLToken::CompactHTMLToken (constHTMLToken*token, const TextPosition&t), following modification is made:
Wherein method attemptStaticAliasStringCreation () is to read primitive name from alias hash table.
(a4) when browser needs to compare the attribute value title of hypertext markup language, first query steps (a1) are established other Name hash table, if it is possible to find attribute value title, then be handled with its corresponding original value title, otherwise, just with the attribute Value title is handled;
Step a4 needs to modify third_party/WebKit/Source/core/html/ by taking Meta label as an example HTMLMetaElement-in.cpp, method voidHTMLMetaElement::processViewportKeyValuePair () and voidHTMLMetaElement::process () find the primitive name of attribute-name and attribute value title.
(2) for the processing of cascading style sheets
(b1) setting browser need selector in the cascading style sheets that identifies, attribute, value, organization alias, Establish alias hash table;
In third_party/WebKit/Source/core/Init.cpp file void CoreInitializer:: Alias hash table is established in init () method.
(b2) browser resolves to cascading style sheets selector title when, query steps (b1) establish alias hash Table, if it is possible to find the selector, then be handled with its corresponding original title, otherwise, just be located with the selector title Reason;
(b3) browser resolves to cascading style sheets Property Name when, query steps (b1) establish alias hash table, If the Property Name can be found, handled with its corresponding original title, otherwise, is just handled with the Property Name;
(b4) when browser needs to compare the value of cascading style sheets, the alias hash table that query steps (b1) are established, if The value can be found, then is handled with its corresponding original value, otherwise, is just handled with the value;
(b5) when browser needs to compare the unit of cascading style sheets, the alias hash table that query steps (b1) are established, such as Fruit can find the organization, then handled with its corresponding original title, otherwise, just be handled with the organization;
The code that step b2~b5 is realized is as follows:
File third_party/WebKit/Source/core/css/parser/CSSParserToken .cpp is modified, Method CSSPropertyID CSSParserToken::parseAsUnresolvedCSSPropertyID () const, CSSValueID CSSParserToken::id () const, finds original title.
Modify file third_party/WebKit/Source/core/css/parser/CSSParserToken .h, side Method bool valueEqualsIgnoringCase (const char*str) const, is compared using original title.
Modify file third_party/WebKit/Source/core/css/parser/CSSParserValue S.cpp, method CSSParserValueList::CSSParserValueList (CSSParserTokenRange range), Use original title.
Modify file third_party/WebKit/Source/core/css/parser/CSSSelectorPar Ser.cpp, method bool CSSSelectorParser::consumeName (), uses original title.
(3) customized label of hypertext markup language is handled
(c1) alias of the bookmark name of customized label is set;
(c2) alias of the Property Name of customized label is set;
(c3) before registering customized label, the alias of customized target bookmark name and Property Name is set;
(c4) complete customized label registration after, setting the alias definition of the bookmark name of useful customized label mark Object is signed, the tag name of these label objects is revised as primitive name, and modify the Property Name of the label object, by attribute-name Title is changed to primitive name;
(c5) when creating customized label object, judge whether tag name and attribute-name are alias, if it is, modification mark Signature and the entitled primitive name of attribute.
The code that step c1~c5 is realized is as follows:
File third_party/WebKit/Source/core/dom/Attribute.h is modified,
- void parserSetName (const QualifiedName&name) { m_name=name;}
+ void parserSetName (const QualifiedName&name) const { m_name=name;}
-QualifiedName m_name;
+mutable QualifiedName m_name;
Modify file third_party/WebKit/Source/core/dom/Document.idl, increase+void setElementAlias(DOMString type,DOMString alias,object attributesAlias);
Modify file, third_party/WebKit/Source/core/dom/Element.h, third_party/ WebKit/Source/core/dom/Element.cpp increases the method for modification attribute-name and tag name.
File third_party/WebKit/Source/core/dom/custom/CustomElement. h is modified, Third_party/WebKit/Source/core/dom/custom/CustomElement. cpp increases the side for updating alias Method.
Modify file third_party/WebKit/Source/core/dom/custom/CustomElementR egis TrationContext.h, third_party/WebKit/Source/core/dom/custom/CustomElementR egi StrationContext.cpp increases the method for setting customized label alias.
Modify file third_party/WebKit/Source/core/dom/custom/CustomElementR egis TrationContext.cpp inquires original title, the label that update is created with alias when registering and creating customized label Title and Property Name.
Modify file third_party/WebKit/Source/core/dom/custom/ CustomElementRegistry.h, third_party/WebKit/Source/core/dom/custom/ CustomElementRegistry.cpp provides setting alias method.
By modifying above, existing following HTML/CSS code:
It can be write with of this sort Chinese:
When there is the customized label defined in English:
<' three ' last=' of x-custom first='/>
Pass through the alias for calling setting label and attribute:
Document.setElementAlias ([' x-custom ', ' is general-customized '], [[' first ', ' name '], [' last', ' surname ']])
It can be used in this way with Chinese:
<general-customized name=' three ' surnames=' opening '/>
Different human language alias is set, so that it may write code with different human languages.
Embodiments of the present invention are elaborated above.But present invention is not limited to the embodiments described above, Technical field those of ordinary skill within the scope of knowledge, can also do without departing from the purpose of the present invention Various change out.

Claims (1)

1. one kind realizes the method for writing code across human language on computers, which comprises the following steps:
(1) the defined label of hypertext markup language is handled
(a1) label for the hypertext markup language that browser needs to identify, the alias of attribute-name, attribute value title are set, established Alias hash table;
(a2) when the bookmark name of browser resolves hypertext markup language, the alias hash table that first query steps (a1) are established, If the bookmark name can be found, handled with its corresponding original title, otherwise, is just handled with the bookmark name;
(a3) when the attribute-name title of browser resolves hypertext markup language, the alias that first query steps (a1) are established is hashed Table, if it is possible to find the attribute-name title, then be handled with its corresponding original title, otherwise, just with the attribute-name title To handle;
(a4) when browser needs to compare the attribute value title of hypertext markup language, the alias that first query steps (a1) are established dissipates List, if it is possible to find attribute value title, then be handled with its corresponding original value title, otherwise, just with the attribute value name Claim to handle;
(2) for the processing of cascading style sheets
(b1) setting browser need selector in the cascading style sheets that identifies, attribute, value, organization alias, establish Alias hash table;
(b2) browser resolves to cascading style sheets selector title when, query steps (b1) establish alias hash table, such as Fruit can find the selector, then handled with its corresponding original title, otherwise, just be handled with the selector title;
(b3) browser resolves to cascading style sheets Property Name when, query steps (b1) establish alias hash table, if The Property Name can be found, then is handled with its corresponding original title, otherwise, is just handled with the Property Name;
(b4) when browser needs to compare the value of cascading style sheets, the alias hash table of query steps (b1) foundation, if it is possible to The value is found, then is handled with its corresponding original value, otherwise, is just handled with the value;
(b5) when browser needs to compare the unit of cascading style sheets, the alias hash table that query steps (b1) are established, if energy The organization is enough found, then is handled with its corresponding original title, otherwise, is just handled with the organization;
(3) customized label of hypertext markup language is handled
(c1) alias of the bookmark name of customized label is set;
(c2) alias of the Property Name of customized label is set;
(c3) before registering customized label, the alias of customized target bookmark name and Property Name is set;
(c4) complete customized label registration after, setting the alias definition of the bookmark name of useful customized label label pair As the tag name of these label objects being revised as primitive name, and modify the Property Name of the label object, Property Name being changed For primitive name;
(c5) when creating customized label object, judge whether tag name and attribute-name are alias, if it is, modification tag name With the entitled primitive name of attribute.
CN201610460121.3A 2016-06-22 2016-06-22 A method of it realizes write code across human language on computers Active CN106126227B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610460121.3A CN106126227B (en) 2016-06-22 2016-06-22 A method of it realizes write code across human language on computers

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610460121.3A CN106126227B (en) 2016-06-22 2016-06-22 A method of it realizes write code across human language on computers

Publications (2)

Publication Number Publication Date
CN106126227A CN106126227A (en) 2016-11-16
CN106126227B true CN106126227B (en) 2019-03-19

Family

ID=57268482

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610460121.3A Active CN106126227B (en) 2016-06-22 2016-06-22 A method of it realizes write code across human language on computers

Country Status (1)

Country Link
CN (1) CN106126227B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110221825B (en) * 2019-06-10 2022-11-18 周登祥 Method for realizing native language programming on computer

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1482539A (en) * 2002-09-09 2004-03-17 四川中圣计算机软件开发有限责任公司 Full-Chinese computer programming language
WO2007074469A3 (en) * 2005-12-27 2008-08-07 Vaakya Technologies Private Lt Method and system for compiling a source code
CN102902660A (en) * 2011-07-26 2013-01-30 苗玉水 Holographic Chinese information processing method by Quanpin and Jianpin of Chinese phonetic codes
CN103543997A (en) * 2012-07-17 2014-01-29 于丙超 Three-word programming method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1482539A (en) * 2002-09-09 2004-03-17 四川中圣计算机软件开发有限责任公司 Full-Chinese computer programming language
WO2007074469A3 (en) * 2005-12-27 2008-08-07 Vaakya Technologies Private Lt Method and system for compiling a source code
CN102902660A (en) * 2011-07-26 2013-01-30 苗玉水 Holographic Chinese information processing method by Quanpin and Jianpin of Chinese phonetic codes
CN103543997A (en) * 2012-07-17 2014-01-29 于丙超 Three-word programming method

Also Published As

Publication number Publication date
CN106126227A (en) 2016-11-16

Similar Documents

Publication Publication Date Title
CN106126227B (en) A method of it realizes write code across human language on computers
CN103617079B (en) The switching method and system of a kind of IE6 kernels and novel I E kernels
Yamada et al. Weighting of noun phrases based on local frequency of nouns
De Baer et al. Facilitating Ontology (Re) use by Means of a Categorization Framework
Descy Making a world-wide web page
Cui et al. A design of MathML web based formula search system
Smith-Gratto et al. MERLOT: Reaping the on-line vineyard
Dudfield Cyberliteracies: Implications for education
Hannabuss The Blackwell Companion to Religious Ethics
Wang et al. The Design and Implementation of Campus Web Search Engine
Goodwin-Jones Web Browser Trends and Technologies
Yin et al. Theme-Based Spider for Academic Paper
Pitner et al. Improving Document Reusability with Adaptive XML Inclusions
Risinger Social studies portals: More than just a web page
Glasgow Saunders Lewis: Selected Poems.
Paulson Damselfly Genera of the New World, an Illustrated and Annotated Key to the Zygoptera
DePalma et al. Corrigendum to: The First Giant Raptor (theropoda: Dromaeosauridae) from the Hell Creek Formation
Stock Wilt L. Idema, The Metamorphosis of Tianxian pei: Local Opera Under the Revolution (1949-1956)
Li et al. Web-based parallel corpora for statistical machine translation
Shapiro et al. Breaking the shackles of the physical page: Site level authoring for XML using ASML.
West et al. Add a Search Field to Your Website
Reynolds Mesopotamian Cosmic Geography.
Sprinkle Six years and change
Gupta et al. A novel approach for link context extraction using Bison parser
Uijtdehaage Designing Web-based image databases to enhance medical education

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20190329

Address after: 561300 No. 97 East Suburb Road, Huajiang Town, Guanling Buyi and Miao Autonomous County, Anshun City, Guizhou Province

Patentee after: Zhou Dengxiang

Address before: 100107 Beijing Chaoyang District Tianlangyuan C Block 3 Floor 03 Business (Harvest Incubator 2777)

Patentee before: Beijing Pu Hui Technology Co. Ltd.

TR01 Transfer of patent right