How to use the homunculus.getClass function in homunculus

To help you get started, we’ve selected a few homunculus examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github army8735 / jsdc / src / DefaultValue.js View on Github external
var homunculus = require('homunculus');
var JsNode = homunculus.getClass('Node', 'es6');
var Token = homunculus.getClass('Token');

var Class = require('./util/Class');
var join = require('./join');

var DefaultValue = Class(function(jsdc) {
  this.jsdc = jsdc;
  this.hash = {};
}).methods({
  param: function(fmparams) {
    var self = this;
    if(fmparams.name() == JsNode.FMPARAMS && fmparams.size()) {
      var fnbody = fmparams.next().next().next().nid();
      fmparams.leaves().forEach(function(sgname) {
        if(sgname.name() == JsNode.SINGLENAME && sgname.size() == 2) {
          var init = sgname.last();
          if(init.name() == JsNode.INITLZ) {
github army8735 / jsdc / web / Template.js View on Github external
define(function(require, exports, module){var homunculus = require('homunculus');
var JsNode = homunculus.getClass('Node', 'es6');
var Token = homunculus.getClass('Token');

var Class = require('./util/Class');

var Template = Class(function(jsdc) {
  this.jsdc = jsdc;
}).methods({
  parse: function(t) {
    this.jsdc.ignore(t, 'template1');
    var s = t.content();
    var res = '"';
    var has = false;
    outer:
    for(var i = 1; i < s.length - 1; i++) {
      var c = s.charAt(i);
      if(c == '\\') {
        res += '\\';
github army8735 / jsdc / web / ArrayCmph.js View on Github external
define(function(require, exports, module){var homunculus = require('homunculus');
var JsNode = homunculus.getClass('Node', 'es6');
var Token = homunculus.getClass('Token');

var Class = require('./util/Class');
var join = require('./join');

var ArrayCmph = Class(function(jsdc) {
  this.jsdc = jsdc;
  this.hash = {};
}).methods({
  parse: function(node, start) {
    var self = this;
    //忽略[]
    if(start) {
      self.hash[node.nid()] = {
        id: '',
        f: 0
      };
github army8735 / jsdc / web / DefaultValue.js View on Github external
define(function(require, exports, module){var homunculus = require('homunculus');
var JsNode = homunculus.getClass('Node', 'es6');
var Token = homunculus.getClass('Token');

var Class = require('./util/Class');
var join = require('./join');

var DefaultValue = Class(function(jsdc) {
  this.jsdc = jsdc;
  this.hash = {};
}).methods({
  param: function(fmparams) {
    var self = this;
    if(fmparams.name() == JsNode.FMPARAMS && fmparams.size()) {
      var fnbody = fmparams.next().next().next().nid();
      fmparams.leaves().forEach(function(sgname) {
        if(sgname.name() == JsNode.SINGLENAME && sgname.size() == 2) {
          var init = sgname.last();
          if(init.name() == JsNode.INITLZ) {
github army8735 / jsdc / src / Template.js View on Github external
var homunculus = require('homunculus');
var JsNode = homunculus.getClass('Node', 'es6');
var Token = homunculus.getClass('Token');

var Class = require('./util/Class');

var Template = Class(function(jsdc) {
  this.jsdc = jsdc;
}).methods({
  parse: function(t) {
    this.jsdc.ignore(t, 'template1');
    var s = t.content();
    var res = '"';
    var has = false;
    outer:
    for(var i = 1; i < s.length - 1; i++) {
      var c = s.charAt(i);
      if(c == '\\') {
        res += '\\';
github army8735 / jsdc / src / Forof.js View on Github external
var homunculus = require('homunculus');
var JsNode = homunculus.getClass('Node', 'es6');
var Token = homunculus.getClass('Token');

var Class = require('./util/Class');
var join = require('./join');

var Forof = Class(function(jsdc) {
  this.jsdc = jsdc;
  this.hash = {};
  this.hash2 = {};
  this.pos = {};
  this.destruct = {};
}).methods({
  parse: function(node, start) {
    //有可能被Generator中改写过
    if(node.gen) {
      return;
github army8735 / jsdc / web / Forof.js View on Github external
define(function(require, exports, module){var homunculus = require('homunculus');
var JsNode = homunculus.getClass('Node', 'es6');
var Token = homunculus.getClass('Token');

var Class = require('./util/Class');
var join = require('./join');

var Forof = Class(function(jsdc) {
  this.jsdc = jsdc;
  this.hash = {};
  this.hash2 = {};
  this.pos = {};
  this.destruct = {};
}).methods({
  parse: function(node, start) {
    //有可能被Generator中改写过
    if(node.gen) {
      return;
github army8735 / jsdc / web / Obj.js View on Github external
define(function(require, exports, module){var homunculus = require('homunculus');
var JsNode = homunculus.getClass('Node', 'es6');
var Token = homunculus.getClass('Token');

var Class = require('./util/Class');
var join = require('./join');

var Obj = Class(function(jsdc) {
  this.jsdc = jsdc;
  this.hash = {};
  this.method = {};
  this.temp = {};
}).methods({
  propt: function(node, start) {
    var objltr = node.parent();
    if(objltr.name() == JsNode.OBJLTR) {
      var prmr = objltr.parent();
      var parent = prmr.parent();
github army8735 / jsdc / src / Obj.js View on Github external
var homunculus = require('homunculus');
var JsNode = homunculus.getClass('Node', 'es6');
var Token = homunculus.getClass('Token');

var Class = require('./util/Class');
var join = require('./join');

var Obj = Class(function(jsdc) {
  this.jsdc = jsdc;
  this.hash = {};
  this.method = {};
  this.temp = {};
}).methods({
  propt: function(node, start) {
    var objltr = node.parent();
    if(objltr.name() == JsNode.OBJLTR) {
      var prmr = objltr.parent();
      var parent = prmr.parent();
github army8735 / jsdc / src / Generator.js View on Github external
var homunculus = require('homunculus');
var JsNode = homunculus.getClass('Node', 'es6');
var Token = homunculus.getClass('token');

var Class = require('./util/Class');
var join = require('./join');
var eventbus = require('./eventbus');

var Generator = Class(function(jsdc) {
  this.jsdc = jsdc;
  this.hash = {};
  this.star = {};
  this.stmt = {};
}).methods({
  parse: function(node, start) {
    var self = this;
    if(start) {
      self.jsdc.ignore(node.leaf(1), 'gen1');

homunculus

A lexer&parser by Javascript

MIT
Latest version published 1 year ago

Package Health Score

46 / 100
Full package analysis

Popular homunculus functions