ctReservedWord; } else if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) { options.stricted = param; options.message = Messages.StrictParamDupe; } } options.paramSet[key] = true; } function parseParam(options) { var token, param, params = [], i, def; token = lookahead; if (token.value === '...') { param = parseRestElement(params); validateParam(options, param.argument, param.argument.name); options.params.push(param); options.defaults.push(null); return false; } param = parsePatternWithDefault(params); for (i = 0; i < params.length; i++) { validateParam(options, params[i], params[i].value); } if (param.type === Syntax.AssignmentPattern) { def = param.right; param = param.left; ++options.defaultCount; } options.params.push(param); options.defaults.push(def); return !match(')'); } function parseParams(firstRestricted) { var options; options = { params: [], defaultCount: 0, defaults: [], firstRestricted: firstRestricted }; expect('('); if (!match(')')) { options.paramSet = {}; while (startIndex < length) { if (!parseParam(options)) { break; } expect(','); } } expect(')'); if (options.defaultCount === 0) { options.defaults = []; } return { params: options.params, defaults: options.defaults, stricted: options.stricted, firstRestricted: options.firstRestricted, message: options.message }; } function parseFunctionDeclaration(node, identifierIsOptional) { var id = null, params = [], defaults = [], body, token, stricted, tmp, firstRestricted, message, previousStrict, isGenerator, previousAllowYield; previousAllowYield = state.allowYield; expectKeyword('function'); isGenerator = match('*'); if (isGenerator) { lex(); } if (!identifierIsOptional || !match('(')) { token = lookahead; id = parseVariableIdentifier(); if (strict) { if (isRestrictedWord(token.value)) { tolerateUnexpectedToken(token, Messages.StrictFunctionName); } } else { if (isRestrictedWord(token.value)) { firstRestricted = token; message = Messages.StrictFunctionName; } else if (isStrictModeReservedWord(token.value)) { firstRestricted = token; message = Messages.StrictReservedWord; } } } state.allowYield = !isGenerator; tmp = parseParams(firstRestricted); params = tmp.params; defaults = tmp.defaults; stricted = tmp.stricted; firstRestricted = tmp.firstRestricted; if (tmp.message) { message = tmp.message; } previousStrict = strict; body = parseFunctionSourceElements(); if (strict && firstRestricted) { throwUnexpectedToken(firstRestricted, message); } if (strict && stricted) { tolerateUnexpectedToken(stricted, message); } strict = previousStrict; state.allowYield = previousAllowYield; return node.finishFunctionDeclaration(id, params, defaults, body, isGenerator); } function parseFunctionExpression() { var token, id = null, stricted, firstRestricted, message, tmp, params = [], defaults = [], body, previousStrict, node = new Node(), isGenerator, previousAllowYield; previousAllowYield = state.allowYield; expectKeyword('function'); isGenerator = match('*'); if (isGenerator) { lex(); } state.allowYield = !isGenerator; if (!match('(')) { token = lookahead; id = (!strict && !isGenerator && matchKeyword('yield')) ? parseNonComputedProperty() : parseVariableIdentifier(); if (strict) { if (isRestrictedWord(token.value)) { tolerateUnexpectedToken(token, Messages.StrictFunctionName); } } else { if (isRestrictedWord(token.value)) { firstRestricted = token; message = Messages.StrictFunctionName; } else if (isStrictModeReservedWord(token.value)) { firstRestricted = token; message = Messages.StrictReservedWord; } } } tmp = parseParams(firstRestricted); params = tmp.params; defaults = tmp.defaults; stricted = tmp.stricted; firstRestricted = tmp.firstRestricted; if (tmp.message) { message = tmp.message; } previousStrict = strict; body = parseFunctionSourceElements(); if (strict && firstRestricted) { throwUnexpectedToken(firstRestricted, message); } if (strict && stricted) { tolerateUnexpectedToken(stricted, message); } strict = previousStrict; state.allowYield = previousAllowYield; return node.finishFunctionExpression(id, params, defaults, body, isGenerator); } // ECMA-262 14.5 Class Definitions function parseClassBody() { var classBody, token, isStatic, hasConstructor = false, body, method, computed, key; classBody = new Node(); expect('{'); body = []; while (!match('}')) { if (match(';')) { lex(); } else { method = new Node(); token = lookahead; isStatic = false; computed = match('['); if (match('*')) { lex(); } else { key = parseObjectPropertyKey(); if (key.name === 'static' && (lookaheadPropertyName() || match('*'))) { token = lookahead; isStatic = true; computed = match('['); if (match('*')) { lex(); } else { key = parseObjectPropertyKey(); } } } method = tryParseMethodDefinition(token, key, computed, method); if (method) { method['static'] = isStatic; // jscs:ignore requireDotNotation if (method.kind === 'init') { method.kind = 'method'; } if (!isStatic) { if (!method.computed && (method.key.name || method.key.value.toString()) === 'constructor') { if (method.kind !== 'method' || !method.method || method.value.generator) { throwUnexpectedToken(token, Messages.ConstructorSpecialMethod); } if (hasConstructor) { throwUnexpectedToken(token, Messages.DuplicateConstructor); } else { hasConstructor = true; } method.kind = 'constructor'; } } else { if (!method.computed && (method.key.name || method.key.value.toString()) === 'prototype') { throwUnexpectedToken(token, Messages.StaticPrototype); } } method.type = Syntax.MethodDefinition; delete method.method; delete method.shorthand; body.push(method); } else { throwUnexpectedToken(lookahead); } } } lex(); return classBody.finishClassBody(body); } function parseClassDeclaration(identifierIsOptional) { var id = null, superClass = null, classNode = new Node(), classBody, previousStrict = strict; strict = true; expectKeyword('class'); if (!identifierIsOptional || lookahead.type === Token.Identifier) { id = parseVariableIdentifier(); } if (matchKeyword('extends')) { lex(); superClass = isolateCoverGrammar(parseLeftHandSideExpressionAllowCall); } classBody = parseClassBody(); strict = previousStrict; return classNode.finishClassDeclaration(id, superClass, classBody); } function parseClassExpression() { var id = null, superClass = null, classNode = new Node(), classBody, previousStrict = strict; strict = true; expectKeyword('class'); if (lookahead.type === Token.Identifier) { id = parseVariableIdentifier(); } if (matchKeyword('extends')) { lex(); superClass = isolateCoverGrammar(parseLeftHandSideExpressionAllowCall); } classBody = parseClassBody(); strict = previousStrict; return classNode.finishClassExpression(id, superClass, classBody); } // ECMA-262 15.2 Modules function parseModuleSpecifier() { var node = new Node(); if (lookahead.type !== Token.StringLiteral) { throwError(Messages.InvalidModuleSpecifier); } return node.finishLiteral(lex()); } // ECMA-262 15.2.3 Exports function parseExportSpecifier() { var exported, local, node = new Node(), def; if (matchKeyword('default')) { // export {default} from 'something'; def = new Node(); lex(); local = def.finishIdentifier('default'); } else { local = parseVariableIdentifier(); } if (matchContextualKeyword('as')) { lex(); exported = parseNonComputedProperty(); } return node.finishExportSpecifier(local, exported); } function parseExportNamedDeclaration(node) { var declaration = null, isExportFromIdentifier, src = null, specifiers = []; // non-default export if (lookahead.type === Token.Keyword) { // covers: // export var f = 1; switch (lookahead.value) { case 'let': case 'const': declaration = parseLexicalDeclaration({inFor: false}); return node.finishExportNamedDeclaration(declaration, specifiers, null); case 'var': case 'class': case 'function': declaration = parseStatementListItem(); return node.finishExportNamedDeclaration(declaration, specifiers, null); } } expect('{'); while (!match('}')) { isExportFromIdentifier = isExportFromIdentifier || matchKeyword('default'); specifiers.push(parseExportSpecifier()); if (!match('}')) { expect(','); if (match('}')) { break; } } } expect('}'); if (matchContextualKeyword('from')) { // covering: // export {default} from 'foo'; // export {foo} from 'foo'; lex(); src = parseModuleSpecifier(); consumeSemicolon(); } else if (isExportFromIdentifier) { // covering: // export {default}; // missing fromClause throwError(lookahead.value ? Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value); } else { // cover // export {foo}; consumeSemicolon(); } return node.finishExportNamedDeclaration(declaration, specifiers, src); } function parseExportDefaultDeclaration(node) { var declaration = null, expression = null; // covers: // export default ... expectKeyword('default'); if (matchKeyword('function')) { // covers: // export default function foo () {} // export default function () {} declaration = parseFunctionDeclaration(new Node(), true); return node.finishExportDefaultDeclaration(declaration); } if (matchKeyword('class')) { declaration = parseClassDeclaration(true); return node.finishExportDefaultDeclaration(declaration); } if (matchContextualKeyword('from')) { throwError(Messages.UnexpectedToken, lookahead.value); } // covers: // export default {}; // export default []; // export default (1 + 2); if (match('{')) { expression = parseObjectInitializer(); } else if (match('[')) { expression = parseArrayInitializer(); } else { expression = parseAssignmentExpression(); } consumeSemicolon(); return node.finishExportDefaultDeclaration(expression); } function parseExportAllDeclaration(node) { var src; // covers: // export * from 'foo'; expect('*'); if (!matchContextualKeyword('from')) { throwError(lookahead.value ? Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value); } lex(); src = parseModuleSpecifier(); consumeSemicolon(); return node.finishExportAllDeclaration(src); } function parseExportDeclaration() { var node = new Node(); if (state.inFunctionBody) { throwError(Messages.IllegalExportDeclaration); } expectKeyword('export'); if (matchKeyword('default')) { return parseExportDefaultDeclaration(node); } if (match('*')) { return parseExportAllDeclaration(node); } return parseExportNamedDeclaration(node); } // ECMA-262 15.2.2 Imports function parseImportSpecifier() { // import {<foo as bar>} ...; var local, imported, node = new Node(); imported = parseNonComputedProperty(); if (matchContextualKeyword('as')) { lex(); local = parseVariableIdentifier(); } return node.finishImportSpecifier(local, imported); } function parseNamedImports() { var specifiers = []; // {foo, bar as bas} expect('{'); while (!match('}')) { specifiers.push(parseImportSpecifier()); if (!match('}')) { expect(','); if (match('}')) { break; } } } expect('}'); return specifiers; } function parseImportDefaultSpecifier() { // import <foo> ...; var local, node = new Node(); local = parseNonComputedProperty(); return node.finishImportDefaultSpecifier(local); } function parseImportNamespaceSpecifier() { // import <* as foo> ...; var local, node = new Node(); expect('*'); if (!matchContextualKeyword('as')) { throwError(Messages.NoAsAfterImportNamespace); } lex(); local = parseNonComputedProperty(); return node.finishImportNamespaceSpecifier(local); } function parseImportDeclaration() { var specifiers = [], src, node = new Node(); if (state.inFunctionBody) { throwError(Messages.IllegalImportDeclaration); } expectKeyword('import'); if (lookahead.type === Token.StringLiteral) { // import 'foo'; src = parseModuleSpecifier(); } else { if (match('{')) { // import {bar} specifiers = specifiers.concat(parseNamedImports()); } else if (match('*')) { // import * as foo specifiers.push(parseImportNamespaceSpecifier()); } else if (isIdentifierName(lookahead) && !matchKeyword('default')) { // import foo specifiers.push(parseImportDefaultSpecifier()); if (match(',')) { lex(); if (match('*')) { // import foo, * as foo specifiers.push(parseImportNamespaceSpecifier()); } else if (match('{')) { // import foo, {bar} specifiers = specifiers.concat(parseNamedImports()); } else { throwUnexpectedToken(lookahead); } } } else { throwUnexpectedToken(lex()); } if (!matchContextualKeyword('from')) { throwError(lookahead.value ? Messages.UnexpectedToken : Messages.MissingFromClause, lookahead.value); } lex(); src = parseModuleSpecifier(); } consumeSemicolon(); return node.finishImportDeclaration(specifiers, src); } // ECMA-262 15.1 Scripts function parseScriptBody() { var statement, body = [], token, directive, firstRestricted; while (startIndex < length) { token = lookahead; if (token.type !== Token.StringLiteral) { break; } statement = parseStatementListItem(); body.push(statement); if (statement.expression.type !== Syntax.Literal) { // this is not directive break; } directive = source.slice(token.start + 1, token.end - 1); if (directive === 'use strict') { strict = true; if (firstRestricted) { tolerateUnexpectedToken(firstRestricted, Messages.StrictOctalLiteral); } } else { if (!firstRestricted && token.octal) { firstRestricted = token; } } } while (startIndex < length) { statement = parseStatementListItem(); /* istanbul ignore if */ if (typeof statement === 'undefined') { break; } body.push(statement); } return body; } function parseProgram() { var body, node; peek(); node = new Node(); body = parseScriptBody(); return node.finishProgram(body, state.sourceType); } function filterTokenLocation() { var i, entry, token, tokens = []; for (i = 0; i < extra.tokens.length; ++i) { entry = extra.tokens[i]; token = { type: entry.type, value: entry.value }; if (entry.regex) { token.regex = { pattern: entry.regex.pattern, flags: entry.regex.flags }; } if (extra.range) { token.range = entry.range; } if (extra.loc) { token.loc = entry.loc; } tokens.push(token); } extra.tokens = tokens; } function tokenize(code, options, delegate) { var toString, tokens; toString = String; if (typeof code !== 'string' && !(code instanceof String)) { code = toString(code); } source = code; index = 0; lineNumber = (source.length > 0) ? 1 : 0; lineStart = 0; startIndex = index; startLineNumber = lineNumber; startLineStart = lineStart; length = source.length; lookahead = null; state = { allowIn: true, allowYield: true, labelSet: {}, inFunctionBody: false, inIteration: false, inSwitch: false, lastCommentStart: -1, curlyStack: [] }; extra = {}; // Options matching. options = options || {}; // Of course we collect tokens here. options.tokens = true; extra.tokens = []; extra.tokenValues = []; extra.tokenize = true; extra.delegate = delegate; // The following two fields are necessary to compute the Regex tokens. extra.openParenToken = -1; extra.openCurlyToken = -1; extra.range = (typeof options.range === 'boolean') && options.range; extra.loc = (typeof options.loc === 'boolean') && options.loc; if (typeof options.comment === 'boolean' && options.comment) { extra.comments = []; } if (typeof options.tolerant === 'boolean' && options.tolerant) { extra.errors = []; } try { peek(); if (lookahead.type === Token.EOF) { return extra.tokens; } lex(); while (lookahead.type !== Token.EOF) { try { lex(); } catch (lexError) { if (extra.errors) { recordError(lexError); // We have to break on the first error // to avoid infinite loops. break; } else { throw lexError; } } } tokens = extra.tokens; if (typeof extra.errors !== 'undefined') { tokens.errors = extra.errors; } } catch (e) { throw e; } finally { extra = {}; } return tokens; } function parse(code, options) { var program, toString; toString = String; if (typeof code !== 'string' && !(code instanceof String)) { code = toString(code); } source = code; index = 0; lineNumber = (source.length > 0) ? 1 : 0; lineStart = 0; startIndex = index; startLineNumber = lineNumber; startLineStart = lineStart; length = source.length; lookahead = null; state = { allowIn: true, allowYield: true, labelSet: {}, inFunctionBody: false, inIteration: false, inSwitch: false, lastCommentStart: -1, curlyStack: [], sourceType: 'script' }; strict = false; extra = {}; if (typeof options !== 'undefined') { extra.range = (typeof options.range === 'boolean') && options.range; extra.loc = (typeof options.loc === 'boolean') && options.loc; extra.attachComment = (typeof options.attachComment === 'boolean') && options.attachComment; if (extra.loc && options.source !== null && options.source !== undefined) { extra.source = toString(options.source); } if (typeof options.tokens === 'boolean' && options.tokens) { extra.tokens = []; } if (typeof options.comment === 'boolean' && options.comment) { extra.comments = []; } if (typeof options.tolerant === 'boolean' && options.tolerant) { extra.errors = []; } if (extra.attachComment) { extra.range = true; extra.comments = []; extra.bottomRightStack = []; extra.trailingComments = []; extra.leadingComments = []; } if (options.sourceType === 'module') { // very restrictive condition for now state.sourceType = options.sourceType; strict = true; } } try { program = parseProgram(); if (typeof extra.comments !== 'undefined') { program.comments = extra.comments; } if (typeof extra.tokens !== 'undefined') { filterTokenLocation(); program.tokens = extra.tokens; } if (typeof extra.errors !== 'undefined') { program.errors = extra.errors; } } catch (e) { throw e; } finally { extra = {}; } return program; } // Sync with *.json manifests. exports.version = '2.7.2'; exports.tokenize = tokenize; exports.parse = parse; // Deep copy. /* istanbul ignore next */ exports.Syntax = (function () { var name, types = {}; if (typeof Object.create === 'function') { types = Object.create(null); } for (name in Syntax) { if (Syntax.hasOwnProperty(name)) { types[name] = Syntax[name]; } } if (typeof Object.freeze === 'function') { Object.freeze(types); } return types; }()); })); /* vim: set sw=4 ts=4 et tw=80 : */ /***/ } /******/ ]); kodo - Gogs: Go Git Service

暫無描述

0003_systemmessageinfo_systemmessagereadinfo.py 2.6KB

    # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('message', '0002_auto_20160120_1830'), ] operations = [ migrations.CreateModel( name='SystemMessageInfo', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('status', models.BooleanField(default=True, help_text='\u72b6\u6001', db_index=True, verbose_name='status')), ('created_at', models.DateTimeField(help_text='\u521b\u5efa\u65f6\u95f4', verbose_name='created_at', auto_now_add=True)), ('updated_at', models.DateTimeField(help_text='\u66f4\u65b0\u65f6\u95f4', verbose_name='updated_at', auto_now=True)), ('title', models.CharField(help_text='\u7cfb\u7edf\u6d88\u606f\u6807\u9898', max_length=255, verbose_name='title')), ('content', models.TextField(help_text='\u7cfb\u7edf\u6d88\u606f\u5185\u5bb9', null=True, verbose_name='content', blank=True)), ('url', models.CharField(help_text='\u7cfb\u7edf\u6d88\u606f\u94fe\u63a5', max_length=255, null=True, verbose_name='url', blank=True)), ], options={ 'verbose_name': 'systemmessageinfo', 'verbose_name_plural': 'systemmessageinfo', }, ), migrations.CreateModel( name='SystemMessageReadInfo', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('status', models.BooleanField(default=True, help_text='\u72b6\u6001', db_index=True, verbose_name='status')), ('created_at', models.DateTimeField(help_text='\u521b\u5efa\u65f6\u95f4', verbose_name='created_at', auto_now_add=True)), ('updated_at', models.DateTimeField(help_text='\u66f4\u65b0\u65f6\u95f4', verbose_name='updated_at', auto_now=True)), ('user_id', models.CharField(max_length=255, blank=True, help_text='\u7528\u6237\u552f\u4e00\u6807\u8bc6', null=True, verbose_name='user_id', db_index=True)), ('msg_id', models.CharField(max_length=255, blank=True, help_text='\u7cfb\u7edf\u6d88\u606f\u552f\u4e00\u6807\u8bc6', null=True, verbose_name='msg_id', db_index=True)), ], options={ 'verbose_name': 'systemmessagereadinfo', 'verbose_name_plural': 'systemmessagereadinfo', }, ), ]